From a53787c754d2236cbd9203afeaf224e96dbae00c Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 14 Nov 2024 19:19:44 +0800 Subject: [PATCH] fix: `git rebase --continue` fail (#693) * fix the exit code when start `SourceGit` as core editor (rebasing). * redesign the layout of working copy page for in-progress states. Signed-off-by: leo --- src/App.axaml.cs | 8 +-- src/Resources/Styles.axaml | 6 +++ src/ViewModels/Repository.cs | 65 ++---------------------- src/ViewModels/WorkingCopy.cs | 94 +++++++++++++++++++++++++++++++++-- src/Views/Repository.axaml | 10 +--- src/Views/WorkingCopy.axaml | 12 +++++ 6 files changed, 119 insertions(+), 76 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index dfec763b..0615724a 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -478,17 +478,20 @@ namespace SourceGit if (args.Length <= 1 || !args[0].Equals("--rebase-message-editor", StringComparison.Ordinal)) return false; + exitCode = 0; + var file = args[1]; var filename = Path.GetFileName(file); if (!filename.Equals("COMMIT_EDITMSG", StringComparison.OrdinalIgnoreCase)) return true; - var jobsFile = Path.Combine(Path.GetDirectoryName(file)!, "sourcegit_rebase_jobs.json"); + var gitDir = Path.GetDirectoryName(file)!; + var jobsFile = Path.Combine(gitDir, "sourcegit_rebase_jobs.json"); if (!File.Exists(jobsFile)) return true; var collection = JsonSerializer.Deserialize(File.ReadAllText(jobsFile), JsonCodeGen.Default.InteractiveRebaseJobCollection); - var doneFile = Path.Combine(Path.GetDirectoryName(file)!, "rebase-merge", "done"); + var doneFile = Path.Combine(gitDir, "rebase-merge", "done"); if (!File.Exists(doneFile)) return true; @@ -499,7 +502,6 @@ namespace SourceGit var job = collection.Jobs[done.Length - 1]; File.WriteAllText(file, job.Message); - exitCode = 0; return true; } diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 8fdfaa3c..82970549 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -512,6 +512,12 @@ + +