summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-02-01 09:11:48 +0100
committerStefan Haller <stefan@haller-berlin.de>2024-02-16 13:01:04 +0100
commitd3804d313c1901ed5b791afd5fca0173d4c40ce0 (patch)
tree1834703da74137b8cb5bf2e204f82fc82debded8
parent8746c3d9e0eb5cd19e74d5b36919da1e37d10d0d (diff)
Fix a problem with refreshing while an update-ref todo is selected
Scenario: - show the files of a commit, escape out of it again - start an interactive rebase of a stack of branches, with the rebase.updateRefs git config set to true - select one of the update-ref todos - trigger a refresh (either manually or by bringing lazygit's terminal window to the front) This results in an error message "fatal: ambiguous argument '': unknown revision or path not in the working tree." Fix this by putting another band-aid on the check for the commit files refresh. This is the easiest way to fix the problem, but I don't think it's the best one. We shouldn't be refreshing the commit files context at all if it isn't visible, because it's pointless; there's no way to switch to it again except by calling viewFiles again with a specific ref. But I'm too lazy too figure out how to do that right now.
-rw-r--r--pkg/gui/controllers/helpers/refresh_helper.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go
index a8f32d116..04b741b56 100644
--- a/pkg/gui/controllers/helpers/refresh_helper.go
+++ b/pkg/gui/controllers/helpers/refresh_helper.go
@@ -274,7 +274,7 @@ func (self *RefreshHelper) refreshCommitsAndCommitFiles() {
// or perhaps we could just pop that context off the stack whenever cycling windows.
// For now the awkwardness remains.
commit := self.c.Contexts().LocalCommits.GetSelected()
- if commit != nil {
+ if commit != nil && commit.RefName() != "" {
self.c.Contexts().CommitFiles.SetRef(commit)
self.c.Contexts().CommitFiles.SetTitleRef(commit.RefName())
_ = self.refreshCommitFilesContext()