From 8dd0274bdd7fe18727328ea320443a5a9f9fb1c3 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 1 Mar 2025 09:21:52 +0800 Subject: [PATCH] enhance: only write MERGE_MSG when commit message is not null Signed-off-by: leo --- src/ViewModels/WorkingCopy.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 3033da07..97684093 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -446,7 +446,7 @@ namespace SourceGit.ViewModels Task.Run(() => { var mergeMsgFile = Path.Combine(_repo.GitDir, "MERGE_MSG"); - if (File.Exists(mergeMsgFile)) + if (File.Exists(mergeMsgFile) && !string.IsNullOrWhiteSpace(_commitMessage)) File.WriteAllText(mergeMsgFile, _commitMessage); var succ = _inProgressContext.Continue(); @@ -729,8 +729,8 @@ namespace SourceGit.ViewModels byParentFolder.IsVisible = !isRooted; byParentFolder.Click += (_, e) => { - var path = Path.GetDirectoryName(change.Path).Replace("\\", "/"); - Commands.GitIgnore.Add(_repo.FullPath, path + "/"); + var dir = Path.GetDirectoryName(change.Path).Replace("\\", "/"); + Commands.GitIgnore.Add(_repo.FullPath, dir + "/"); e.Handled = true; }; addToIgnore.Items.Add(byParentFolder); @@ -751,8 +751,8 @@ namespace SourceGit.ViewModels byExtensionInSameFolder.IsVisible = !isRooted; byExtensionInSameFolder.Click += (_, e) => { - var path = Path.GetDirectoryName(change.Path).Replace("\\", "/"); - Commands.GitIgnore.Add(_repo.FullPath, path + "/*" + extension); + var dir = Path.GetDirectoryName(change.Path).Replace("\\", "/"); + Commands.GitIgnore.Add(_repo.FullPath, dir + "/*" + extension); e.Handled = true; }; addToIgnore.Items.Add(byExtensionInSameFolder);