void CommitToGit() { // COMMIT TO GIT Command CommitToGitCommand = new CommandBase((parameter, e) => { var file = parameter as string; if (string.IsNullOrEmpty(file)) { file = Model.ActiveDocument?.Filename; } if (string.IsNullOrEmpty(file)) { return; } var gh = new GitHelper(); var repo = gh.OpenRepository(file); if (repo == null) { Model.Window.ShowStatusError("This file or folder is not in a Git repository."); return; } var changes = gh.GetRepositoryChanges(repo.Info.WorkingDirectory); if (changes == null && !string.IsNullOrEmpty(gh.ErrorMessage)) { Model.Window.ShowStatusError($"Unable to retrieve Repository status: {gh.ErrorMessage}"); return; } if (changes.Count < 1) { Model.Window.ShowStatusError( $"There are no pending changes for this Git repository: {repo.Info.WorkingDirectory}"); } if (Model.ActiveEditor != null) { Model.ActiveEditor.SaveDocument(Model.ActiveDocument.IsEncrypted); } var form = new GitCommitDialog(file, false); // GitCommitFormModes.ActiveDocument); form.Show(); }, (s, e) => Model.IsEditorActive); CommitToGitCommand.PremiumFeatureName = "Git Support"; CommitToGitCommand.PremiumFeatureLink = "https://markdownmonster.west-wind.com/docs/_4xp0yygt2.htm"; }
void CommitToGit() { // COMMIT TO GIT Command CommitToGitCommand = new CommandBase((parameter, e) => { var file = parameter as string; if (string.IsNullOrEmpty(file)) { file = Model.ActiveDocument?.Filename; } if (string.IsNullOrEmpty(file)) { return; } var gh = new GitHelper(); var repo = gh.OpenRepository(file); if (repo == null) { Model.Window.ShowStatusError("This file or folder is not in a Git repository."); return; } var changes = gh.GetRepositoryChanges(repo.Info.WorkingDirectory); if (changes.Count < 1) { Model.Window.ShowStatusError($"There are no pending changes for this Git repository: {repo.Info.WorkingDirectory}"); } Model.ActiveEditor.SaveDocument(Model.ActiveDocument.IsEncrypted); var form = new GitCommitDialog(file, false); // GitCommitFormModes.ActiveDocument); form.Show(); }, (s, e) => Model.IsEditorActive); }