mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-24 19:39:16 +02:00
Don't auto-forward branches that are checked out by another worktree
This commit is contained in:
@@ -283,7 +283,9 @@ func (self *BranchesHelper) AutoForwardBranches() error {
|
|||||||
updateCommands := ""
|
updateCommands := ""
|
||||||
// The first branch is the currently checked out branch; skip it
|
// The first branch is the currently checked out branch; skip it
|
||||||
for _, branch := range branches[1:] {
|
for _, branch := range branches[1:] {
|
||||||
if branch.RemoteBranchStoredLocally() && (allBranches || lo.Contains(self.c.UserConfig().Git.MainBranches, branch.Name)) {
|
if branch.RemoteBranchStoredLocally() &&
|
||||||
|
!self.checkedOutByOtherWorktree(branch) &&
|
||||||
|
(allBranches || lo.Contains(self.c.UserConfig().Git.MainBranches, branch.Name)) {
|
||||||
isStrictlyBehind := branch.IsBehindForPull() && !branch.IsAheadForPull()
|
isStrictlyBehind := branch.IsBehindForPull() && !branch.IsAheadForPull()
|
||||||
if isStrictlyBehind {
|
if isStrictlyBehind {
|
||||||
updateCommands += fmt.Sprintf("update %s %s %s\n", branch.FullRefName(), branch.FullUpstreamRefName(), branch.CommitHash)
|
updateCommands += fmt.Sprintf("update %s %s %s\n", branch.FullRefName(), branch.FullUpstreamRefName(), branch.CommitHash)
|
||||||
|
@@ -51,10 +51,7 @@ var FetchAndAutoForwardBranchesAllBranchesCheckedOutInOtherWorktree = NewIntegra
|
|||||||
Contains("checked-out").IsSelected(),
|
Contains("checked-out").IsSelected(),
|
||||||
Contains("diverged ↓2↑1"),
|
Contains("diverged ↓2↑1"),
|
||||||
Contains("feature ✓"),
|
Contains("feature ✓"),
|
||||||
/* EXPECTED:
|
|
||||||
Contains("master (worktree) ↓1"),
|
Contains("master (worktree) ↓1"),
|
||||||
ACTUAL: */
|
|
||||||
Contains("master (worktree) ✓"),
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user