Skip to content

Commit

Permalink
Fix unsetting upstream when it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mark2185 committed Nov 4, 2023
1 parent e0fc8fe commit d145e81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 4 additions & 1 deletion pkg/gui/controllers/branches_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ func (self *BranchesController) viewUpstreamOptions(selectedBranch *models.Branc
Key: 'r',
}

if !selectedBranch.IsTrackingRemote() {
unsetUpstreamItem.DisabledReason = self.c.Tr.UpstreamNotSetError
}

if !selectedBranch.RemoteBranchStoredLocally() {
viewDivergenceItem.DisabledReason = self.c.Tr.UpstreamNotSetError
unsetUpstreamItem.DisabledReason = self.c.Tr.UpstreamNotSetError
upstreamResetItem.DisabledReason = self.c.Tr.UpstreamNotSetError
upstreamRebaseItem.DisabledReason = self.c.Tr.UpstreamNotSetError
}
Expand Down
6 changes: 1 addition & 5 deletions pkg/integration/tests/branch/unset_upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ var UnsetUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Title(Equals("Upstream options")).
Select(Contains("Unset upstream of selected branch")).
Confirm()
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Equals("The selected branch has no upstream (or the upstream is not stored locally)")).
Cancel()
}).
SelectedLines(
Contains("branch_to_remove").Contains("origin branch_to_remove").Contains("upstream gone"),
Contains("branch_to_remove").DoesNotContain("origin branch_to_remove").DoesNotContain("upstream gone"),
)
},
})

0 comments on commit d145e81

Please sign in to comment.