refactor: commandline parsing

* `--rebase-todo-editor` launches this app as a git `sequence.editor`
* `--rebase-message-editor` launches this app as a git `core.editor` which runs on background by reading rebasing jobs
* `--core-editor` launches this app as a git `core.editor`
* `--askpass` launches this app as a SSH askpass program
This commit is contained in:
leo 2024-07-09 10:16:15 +08:00
parent cbe4c36525
commit 6930b51c64
No known key found for this signature in database
14 changed files with 320 additions and 155 deletions

View file

@ -1,6 +1,4 @@
using System.Diagnostics;
namespace SourceGit.Commands
namespace SourceGit.Commands
{
public class Rebase : Command
{
@ -19,12 +17,10 @@ namespace SourceGit.Commands
{
public InteractiveRebase(string repo, string basedOn)
{
var exec = Process.GetCurrentProcess().MainModule.FileName;
var editor = $"\\\"{exec}\\\" --rebase-editor";
WorkingDirectory = repo;
Context = repo;
Args = $"-c core.editor=\"{editor}\" -c sequence.editor=\"{editor}\" -c rebase.abbreviateCommands=true rebase -i --autosquash {basedOn}";
Editor = EditorType.RebaseEditor;
Args = $"rebase -i --autosquash {basedOn}";
}
}
}