mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 10:22:13 +08:00
refactor: only auto-track remote branch after creating new local branch when the created branch's name is the same with based remote branch (#1926)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -186,20 +186,9 @@ namespace SourceGit.ViewModels
|
||||
.CreateAsync(_baseOnRevision, _allowOverwrite);
|
||||
}
|
||||
|
||||
if (succ && BasedOn is Models.Branch { IsLocal: false } basedOn)
|
||||
if (succ && BasedOn is Models.Branch { IsLocal: false } basedOn && _name.Equals(basedOn.Name, StringComparison.Ordinal))
|
||||
{
|
||||
var autoSetUpstream = true;
|
||||
foreach (var b in _repo.Branches)
|
||||
{
|
||||
if (b.IsLocal && b.Upstream.Equals(basedOn.FullName, StringComparison.Ordinal))
|
||||
{
|
||||
autoSetUpstream = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (autoSetUpstream)
|
||||
await new Commands.Branch(_repo.FullPath, _name)
|
||||
await new Commands.Branch(_repo.FullPath, _name)
|
||||
.Use(log)
|
||||
.SetUpstreamAsync(basedOn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user