enhance: makes Create New Branch option as the default selected mode for adding new worktree

This commit is contained in:
leo 2024-06-28 14:11:13 +08:00
parent db8e534a0a
commit 3e54ab0227
No known key found for this signature in database
3 changed files with 30 additions and 29 deletions

View file

@ -62,7 +62,7 @@ namespace SourceGit.Commands
return worktrees;
}
public bool Add(string fullpath, string name, string tracking, Action<string> outputHandler)
public bool Add(string fullpath, string name, bool createNew, string tracking, Action<string> outputHandler)
{
Args = "worktree add ";
@ -70,7 +70,12 @@ namespace SourceGit.Commands
Args += "--track ";
if (!string.IsNullOrEmpty(name))
Args += $"-B {name} ";
{
if (createNew)
Args += $"-b {name} ";
else
Args += $"-B {name} ";
}
Args += $"\"{fullpath}\" ";