Ich habe ein Programm aus einem öffentlichen Repository auf meinem Github geholt.Klone ein Projekt funktioniert gut (die Art, wie ich es trotzdem mache), aber ich habe versucht, es zu bekommen um zu arbeiten, um alles zu ziehen und sobald Sie eine Datei löschen, zieht es diese Datei nicht mehr. In meinem Fall löschte ich das .gitignore aus dem gezogenen Repository (das geklonte im Grunde genommen) und jetzt möchte die repo.Network.Pull()
es nicht erneut aus dem Repo herunterladen. Das Gleiche gilt für jede andere Datei, die ich lösche.LibGit2Sharp Pull() nicht gelöschte Dateien
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 + "\"...");
}
Dies ist das Protokoll ich am Ende des Pressens meine Zugknopfs haben:
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.
Was bin ich zu vergessen oder falsch?
That behoben. Vielen Dank. möchte jedoch darauf hinweisen, dass ich in meinem Projekt keinen 'branch.FriendlyName' hatte. Aber es zu 'branch.Name' zu ändern, schien den Trick zu machen. – sxbrentxs
@sxbrentxs FYI: Sie könnten eine ältere Version verwenden, 'FriendlyName' ersetzt die veraltete Namensstütze. https://github.com/libgit2/libgit2sharp/pull/1020 – SushiHangover