diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-03-16 15:48:34 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-03-16 15:48:34 +0100 |
commit | e5fa9e1c4afd84da9d6cabb510c13fb66ebc66f2 (patch) | |
tree | 0fbe43fe57333cb580d8d5ab9ec01e2872220a05 | |
parent | e8d84a1f2ce48845cd31c0fde04334e1f1bc3f76 (diff) |
Store full ref in Name field of update-ref commits
Strip the prefix at presentation time instead. This makes it easier to find
update-ref todos in order to move them up/down, or delete them.
-rw-r--r-- | pkg/commands/git_commands/commit_loader.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/presentation/commits.go | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 7cd7f38b0..df22b91bf 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -348,7 +348,7 @@ func (self *CommitLoader) getRebasingCommits(rebaseMode enums.RebaseMode) []*mod for _, t := range todos { if t.Command == todo.UpdateRef { - t.Msg = strings.TrimPrefix(t.Ref, "refs/heads/") + t.Msg = t.Ref } else if t.Commit == "" { // Command does not have a commit associated, skip continue diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 085504662..dba00f4b6 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -282,7 +282,7 @@ func (self *LocalCommitsController) GetOnRenderToMain() func() error { utils.ResolvePlaceholderString( self.c.Tr.UpdateRefHere, map[string]string{ - "ref": commit.Name, + "ref": strings.TrimPrefix(commit.Name, "refs/heads/"), })) } else { cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath()) diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index bd4057e41..611fdde8c 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -342,6 +342,9 @@ func displayCommit( } name := commit.Name + if commit.Action == todo.UpdateRef { + name = strings.TrimPrefix(name, "refs/heads/") + } if parseEmoji { name = emoji.Sprint(name) } |