diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 6e409d717..bce16de15 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -311,7 +311,9 @@ func (self *CommitLoader) getInteractiveRebasingCommits() ([]*models.Commit, err } for _, t := range todos { - if t.Commit == "" { + if t.Command == todo.UpdateRef { + t.Msg = strings.TrimPrefix(t.Ref, "refs/heads/") + } else if t.Commit == "" { // Command does not have a commit associated, skip continue } diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 8b8c74eec..2b75be4d0 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -1,6 +1,7 @@ package gui import ( + "github.com/fsmiamoto/git-todo-parser/todo" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/utils" @@ -34,6 +35,13 @@ func (gui *Gui) branchCommitsRenderToMain() error { commit := gui.State.Contexts.LocalCommits.GetSelected() if commit == nil { task = types.NewRenderStringTask(gui.c.Tr.NoCommitsThisBranch) + } else if commit.Action == todo.UpdateRef { + task = types.NewRenderStringTask( + utils.ResolvePlaceholderString( + gui.c.Tr.UpdateRefHere, + map[string]string{ + "ref": commit.Name, + })) } else { cmdObj := gui.git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath(), gui.IgnoreWhitespaceInDiffView) diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index 8a4d947c4..7e16197b5 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -347,7 +347,7 @@ func getShaColor( return getBisectStatusColor(bisectStatus) } - diffed := commit.Sha == diffName + diffed := commit.Sha != "" && commit.Sha == diffName shaColor := theme.DefaultTextColor switch commit.Status { case models.StatusUnpushed: diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index e7756d03e..7b6642882 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -105,6 +105,7 @@ type TranslationSet struct { SureResetCommitAuthor string LcRenameCommitEditor string NoCommitsThisBranch string + UpdateRefHere string Error string LcSelectHunk string LcNavigateConflicts string @@ -754,6 +755,7 @@ func EnglishTranslationSet() TranslationSet { LcSquashDown: "squash down", LcFixupCommit: "fixup commit", NoCommitsThisBranch: "No commits for this branch", + UpdateRefHere: "Update branch '{{.ref}}' here", CannotSquashOrFixupFirstCommit: "There's no commit below to squash into", Fixup: "Fixup", SureFixupThisCommit: "Are you sure you want to 'fixup' this commit? It will be merged into the commit below",