Skip to content

Commit 503ac5b

Browse files
committed
refactor: use EndsWith instead of Equals to auto-find the tracking branch while creating worktree (#1983)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 9f9b8f3 commit 503ac5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ViewModels/AddWorktree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private void AutoSelectTrackingBranch()
129129
return;
130130

131131
var name = string.IsNullOrEmpty(_selectedBranch) ? System.IO.Path.GetFileName(_path.TrimEnd('/', '\\')) : _selectedBranch;
132-
var remoteBranch = RemoteBranches.Find(b => b.Substring(b.IndexOf('/') + 1).Equals(name, StringComparison.Ordinal));
132+
var remoteBranch = RemoteBranches.Find(b => b.EndsWith(name, StringComparison.Ordinal));
133133
if (string.IsNullOrEmpty(remoteBranch))
134134
remoteBranch = RemoteBranches[0];
135135

0 commit comments

Comments
 (0)