2
私のgithubでホストされている公開リポジトリからプルするプログラムを作った。プロジェクトのクローン作成はうまくいく(私はとにかくやっている)が、それを手に入れようとしているすべてを取り除くために働くために、あなたがファイルを削除すると、それはもはやそのファイルをプルしません。私の場合、引っ張ったリポジトリ(基本的に複製されたリポジトリ)から.gitignoreを削除しましたが、今度はrepo.Network.Pull()
はリポジトリから再ダウンロードしたくありません。私が削除した他のファイルと同じです。LibGit2Sharp削除されたファイルをプルしない
private void PullButton_Click(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(BrowseText.Text))
if (Directory.Exists(BrowseText.Text))
{
AddToDebugBox("Starting Pull request to \"" + BrowseText.Text + "\"...");
if (!Repository.IsValid(BrowseText.Text))
{
AddToDebugBox("No Git init found at: \"" + BrowseText.Text + "\"...");
Repository.Clone("https://github.com/sxbrentxs/FPS-GLU.git", BrowseText.Text);
AddToDebugBox("Created new git init at: \"" + BrowseText.Text + "\".");
}
else
{
AddToDebugBox("Found git init at: \"" + BrowseText.Text + "\".");
using (Repository repo = new Repository(BrowseText.Text))
{
AddToDebugBox("Starting pull request...");
PullOptions options = new PullOptions();
options.FetchOptions = new FetchOptions();
repo.Network.Pull(new Signature("Updater", "[email protected]", new DateTimeOffset(DateTime.Now)), options);
AddToDebugBox("Completed pull request.");
AddToDebugBox("Calculating differences...");
TreeChanges changes = repo.Diff.Compare<TreeChanges>();
AddToDebugBox(string.Format("{0} files changed.", changes.Count()));
foreach (TreeEntryChanges c in changes)
AddToDebugBox(string.Format("Path: {0} | Change made: {1}", c.Path, c.Status));
}
AddToDebugBox("Operations completed.");
cleanready = !cleanready;
}
}
else
AddToDebugBox("Cannot pull to non-existing path: \"" + BrowseText.Text + "\"...");
else
AddToDebugBox("Cannot pull to nothing: \"" + BrowseText.Text + "\"...");
}
これは私が私のプルボタンを押すの最後に持っているログです:
23:41:55 > Folder: "E:\Projects\Test" selected.
23:41:58 > Starting Pull request to "E:\Projects\Test"...
23:41:58 > Found git init at: "E:\Projects\Test".
23:41:58 > Starting pull request...
23:41:59 > Completed pull request.
23:41:59 > Calculating differences...
23:41:59 > 1 files changed.
23:41:59 > Path: .gitignore | Change made: Deleted
23:41:59 > Operations completed.
私は何を忘れたり、間違っているのでしょうか?
ことそれを固定した。どうもありがとうございました。私のプロジェクトには 'branch.FriendlyName'はありませんでした。しかし、それを 'branch.Name'に変更することはそのトリックを行うように見えました。 – sxbrentxs
@sxbrentxs FYI:古いバージョンを使用していて、「FriendlyName」が旧式の名前propを置き換えている可能性があります。 https://github.com/libgit2/libgit2sharp/pull/1020 – SushiHangover