From 2f9e825b63274eba3330069f4015243aabf0a9c1 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 1 Nov 2024 18:10:22 +0800 Subject: [PATCH] refactor: pass Models.Commit instead of just sha of it Signed-off-by: leo --- src/ViewModels/ExecuteCustomAction.cs | 6 +++--- src/ViewModels/Histories.cs | 2 +- src/ViewModels/Repository.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ViewModels/ExecuteCustomAction.cs b/src/ViewModels/ExecuteCustomAction.cs index e8893f5a..920b9f43 100644 --- a/src/ViewModels/ExecuteCustomAction.cs +++ b/src/ViewModels/ExecuteCustomAction.cs @@ -10,12 +10,12 @@ namespace SourceGit.ViewModels private set; } - public ExecuteCustomAction(Repository repo, Models.CustomAction action, string sha) + public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Commit commit) { _repo = repo; _args = action.Arguments.Replace("${REPO}", _repo.FullPath); - if (!string.IsNullOrEmpty(sha)) - _args = _args.Replace("${SHA}", sha); + if (commit != null) + _args = _args.Replace("${SHA}", commit.SHA); CustomAction = action; View = new Views.ExecuteCustomAction() { DataContext = this }; diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index fc973948..713e1635 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -626,7 +626,7 @@ namespace SourceGit.ViewModels item.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowAndStartPopup(new ExecuteCustomAction(_repo, action, commit.SHA)); + PopupHost.ShowAndStartPopup(new ExecuteCustomAction(_repo, dup, commit)); e.Handled = true; }; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index ae24d5ef..9dd5ab9d 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -1310,7 +1310,7 @@ namespace SourceGit.ViewModels item.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowAndStartPopup(new ExecuteCustomAction(this, action, null)); + PopupHost.ShowAndStartPopup(new ExecuteCustomAction(this, dup, null)); e.Handled = true; };