From 6482ef227abe6d40f019756d5599095754a9d5bf Mon Sep 17 00:00:00 2001 From: GadflyFang Date: Tue, 21 Jan 2025 13:58:07 +0800 Subject: [PATCH] fix: prevent target branch HEAD from being changed when adding worktree (#919) * fix: prevent target branch HEAD from being changed when adding worktree Signed-off-by: Gadfly * fix: worktree path validator trigger error Signed-off-by: Gadfly --------- Signed-off-by: Gadfly --- src/Commands/Worktree.cs | 2 ++ src/ViewModels/AddWorktree.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commands/Worktree.cs b/src/Commands/Worktree.cs index 7516b1e3..27c0e28e 100644 --- a/src/Commands/Worktree.cs +++ b/src/Commands/Worktree.cs @@ -73,6 +73,8 @@ namespace SourceGit.Commands if (!string.IsNullOrEmpty(tracking)) Args += tracking; + else if (!string.IsNullOrEmpty(name) && !createNew) + Args += name; _outputHandler = outputHandler; return Exec(); diff --git a/src/ViewModels/AddWorktree.cs b/src/ViewModels/AddWorktree.cs index cf736029..6c1c7481 100644 --- a/src/ViewModels/AddWorktree.cs +++ b/src/ViewModels/AddWorktree.cs @@ -12,7 +12,7 @@ namespace SourceGit.ViewModels public string Path { get => _path; - set => SetProperty(ref _path, value); + set => SetProperty(ref _path, value, true); } public bool CreateNewBranch