void Commit(IRepository repository, IEnumerable <StatusEntry> entries, string title = "Commit", bool reportProgress = false) { if (entries.Any() || Amend) { var dialog = new CommitDialog(title); if (Amend) { dialog.Message = repository.Commits.FirstOrDefault()?.Message; } if (mainThread.Invoke(() => dialog.ShowDialog()) == true) { if (!string.IsNullOrEmpty(dialog.NewBranchName)) { repository.Checkout(repository.CreateBranch(dialog.NewBranchName)); } foreach (var entry in entries) { repository.Stage(entry.FilePath); } var signature = repository.Config.BuildSignature(DateTimeOffset.Now); var options = new CommitOptions { AmendPreviousCommit = Amend }; eventStream.Push <Status>(0.5f); repository.Commit(dialog.Message, signature, signature, options); } } }
void CommitChanges(IGitRepository repository, IEnumerable <StatusEntry> entries, CommitDialog dialog) { if (mainThread.ShowDialog(dialog) == true) { if (!string.IsNullOrEmpty(dialog.NewBranchName)) { repository.Checkout(repository.CreateBranch(dialog.NewBranchName)); } foreach (var entry in entries) { repository.Stage(entry.FilePath); } eventStream.Push <Status>(0.5f); var signature = repository.Config.BuildSignature(DateTimeOffset.Now); repository.Commit( dialog.Message, signature, signature, CreateCommitOptions()); } }