diff --git a/src/Commands/Commit.cs b/src/Commands/Commit.cs
index 5be08cef..17410bc9 100644
--- a/src/Commands/Commit.cs
+++ b/src/Commands/Commit.cs
@@ -4,7 +4,7 @@ namespace SourceGit.Commands
{
public class Commit : Command
{
- public Commit(string repo, string message, bool amend, bool signOff)
+ public Commit(string repo, string message, bool signOff, bool amend, bool resetAuthor)
{
_tmpFile = Path.GetTempFileName();
File.WriteAllText(_tmpFile, message);
@@ -12,10 +12,10 @@ namespace SourceGit.Commands
WorkingDirectory = repo;
Context = repo;
Args = $"commit --allow-empty --file=\"{_tmpFile}\"";
- if (amend)
- Args += " --amend --no-edit";
if (signOff)
Args += " --signoff";
+ if (amend)
+ Args += resetAuthor ? " --amend --reset-author --no-edit" : " --amend --no-edit";
}
public bool Run()
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index c12396ec..07ebc675 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -781,6 +781,7 @@
INCLUDE UNTRACKED FILES
NO RECENT INPUT MESSAGES
NO COMMIT TEMPLATES
+ Reset Author
Right-click the selected file(s), and make your choice to resolve conflicts.
SignOff
STAGED
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 00939656..2703f5a2 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -785,6 +785,7 @@
显示未跟踪文件
没有提交信息记录
没有可应用的提交信息模板
+ 重置提交者
请选中冲突文件,打开右键菜单,选择合适的解决方式
署名
已暂存
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 026a41ed..f810ea15 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -785,6 +785,7 @@
顯示未追蹤檔案
沒有提交訊息記錄
沒有可套用的提交訊息範本
+ 重設作者
請選擇發生衝突的檔案,開啟右鍵選單,選擇合適的解決方式
署名
已暫存
diff --git a/src/ViewModels/Reword.cs b/src/ViewModels/Reword.cs
index 82fa3169..72dd9e58 100644
--- a/src/ViewModels/Reword.cs
+++ b/src/ViewModels/Reword.cs
@@ -37,9 +37,11 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("Reword HEAD");
Use(log);
+ var signOff = _repo.Settings.EnableSignOffForCommit;
return Task.Run(() =>
{
- var succ = new Commands.Commit(_repo.FullPath, _message, true, _repo.Settings.EnableSignOffForCommit).Use(log).Run();
+ // For reword (only changes the commit message), disable `--reset-author`
+ var succ = new Commands.Commit(_repo.FullPath, _message, signOff, true, false).Use(log).Run();
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
diff --git a/src/ViewModels/Squash.cs b/src/ViewModels/Squash.cs
index fa9d98e1..0d680d20 100644
--- a/src/ViewModels/Squash.cs
+++ b/src/ViewModels/Squash.cs
@@ -34,6 +34,7 @@ namespace SourceGit.ViewModels
return Task.Run(() =>
{
+ var signOff = _repo.Settings.EnableSignOffForCommit;
var autoStashed = false;
var succ = false;
@@ -52,7 +53,7 @@ namespace SourceGit.ViewModels
succ = new Commands.Reset(_repo.FullPath, Target.SHA, "--soft").Use(log).Exec();
if (succ)
- succ = new Commands.Commit(_repo.FullPath, _message, true, _repo.Settings.EnableSignOffForCommit).Use(log).Run();
+ succ = new Commands.Commit(_repo.FullPath, _message, signOff, true, true).Use(log).Run();
if (succ && autoStashed)
new Commands.Stash(_repo.FullPath).Use(log).Pop("stash@{0}");
diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs
index 7c2d95f9..64c7b31d 100644
--- a/src/ViewModels/WorkingCopy.cs
+++ b/src/ViewModels/WorkingCopy.cs
@@ -91,6 +91,7 @@ namespace SourceGit.ViewModels
else
{
CommitMessage = string.Empty;
+ ResetAuthor = false;
}
Staged = GetStagedChanges();
@@ -100,6 +101,12 @@ namespace SourceGit.ViewModels
}
}
+ public bool ResetAuthor
+ {
+ get => _resetAuthor;
+ set => SetProperty(ref _resetAuthor, value);
+ }
+
public string Filter
{
get => _filter;
@@ -1717,6 +1724,7 @@ namespace SourceGit.ViewModels
_repo.Settings.PushCommitMessage(_commitMessage);
_repo.SetWatcherEnabled(false);
+ var signOff = _repo.Settings.EnableSignOffForCommit;
var log = _repo.CreateLog("Commit");
Task.Run(() =>
{
@@ -1725,7 +1733,7 @@ namespace SourceGit.ViewModels
succ = new Commands.Add(_repo.FullPath, _repo.IncludeUntracked).Use(log).Exec();
if (succ)
- succ = new Commands.Commit(_repo.FullPath, _commitMessage, _useAmend, _repo.Settings.EnableSignOffForCommit).Use(log).Run();
+ succ = new Commands.Commit(_repo.FullPath, _commitMessage, signOff, _useAmend, _resetAuthor).Use(log).Run();
log.Complete();
@@ -1785,6 +1793,7 @@ namespace SourceGit.ViewModels
private bool _isUnstaging = false;
private bool _isCommitting = false;
private bool _useAmend = false;
+ private bool _resetAuthor = false;
private bool _hasRemotes = false;
private List _cached = [];
private List _unstaged = [];
diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml
index ee8619f3..8c600956 100644
--- a/src/Views/WorkingCopy.axaml
+++ b/src/Views/WorkingCopy.axaml
@@ -235,7 +235,7 @@
-
+
-
+
+
-
-