diff --git a/pkg/commands/branch.go b/pkg/commands/branch.go index b182b8b6d..321101755 100644 --- a/pkg/commands/branch.go +++ b/pkg/commands/branch.go @@ -20,3 +20,7 @@ func (b *Branch) RefName() string { func (b *Branch) ID() string { return b.RefName() } + +func (b *Branch) Description() string { + return b.RefName() +} diff --git a/pkg/commands/commit.go b/pkg/commands/commit.go index c0483f3f0..1e3a410c2 100644 --- a/pkg/commands/commit.go +++ b/pkg/commands/commit.go @@ -21,10 +21,6 @@ func (c *Commit) ShortSha() string { return c.Sha[:8] } -func (c *Commit) NameWithSha() string { - return fmt.Sprintf("%s %s", c.Sha[:7], c.Name) -} - func (c *Commit) RefName() string { return c.Sha } @@ -32,3 +28,7 @@ func (c *Commit) RefName() string { func (c *Commit) ID() string { return c.RefName() } + +func (c *Commit) Description() string { + return fmt.Sprintf("%s %s", c.Sha[:7], c.Name) +} diff --git a/pkg/commands/commit_file.go b/pkg/commands/commit_file.go index 2b231e079..4e632f07a 100644 --- a/pkg/commands/commit_file.go +++ b/pkg/commands/commit_file.go @@ -11,3 +11,7 @@ type CommitFile struct { func (f *CommitFile) ID() string { return f.Name } + +func (f *CommitFile) Description() string { + return f.Name +} diff --git a/pkg/commands/file.go b/pkg/commands/file.go index 12f63c9db..774e47fd7 100644 --- a/pkg/commands/file.go +++ b/pkg/commands/file.go @@ -40,3 +40,7 @@ func (f *File) Matches(f2 *File) bool { func (f *File) ID() string { return f.Name } + +func (f *File) Description() string { + return f.Name +} diff --git a/pkg/commands/remote.go b/pkg/commands/remote.go index 17ed8c1ca..1ce12963e 100644 --- a/pkg/commands/remote.go +++ b/pkg/commands/remote.go @@ -14,3 +14,7 @@ func (r *Remote) RefName() string { func (r *Remote) ID() string { return r.RefName() } + +func (r *Remote) Description() string { + return r.RefName() +} diff --git a/pkg/commands/remote_branch.go b/pkg/commands/remote_branch.go index 656546815..36199e46f 100644 --- a/pkg/commands/remote_branch.go +++ b/pkg/commands/remote_branch.go @@ -17,3 +17,7 @@ func (r *RemoteBranch) RefName() string { func (r *RemoteBranch) ID() string { return r.RefName() } + +func (r *RemoteBranch) Description() string { + return r.RefName() +} diff --git a/pkg/commands/stash_entry.go b/pkg/commands/stash_entry.go index 487da0f00..bdb899a75 100644 --- a/pkg/commands/stash_entry.go +++ b/pkg/commands/stash_entry.go @@ -15,3 +15,7 @@ func (s *StashEntry) RefName() string { func (s *StashEntry) ID() string { return s.RefName() } + +func (s *StashEntry) Description() string { + return s.RefName() + ": " + s.Name +} diff --git a/pkg/commands/tag.go b/pkg/commands/tag.go index 2009472b2..a51c9660a 100644 --- a/pkg/commands/tag.go +++ b/pkg/commands/tag.go @@ -12,3 +12,7 @@ func (t *Tag) RefName() string { func (t *Tag) ID() string { return t.RefName() } + +func (t *Tag) Description() string { + return "tag " + t.Name +} diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index bf6aaeaaf..25b427b25 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -33,7 +33,11 @@ type ListContext struct { } type ListItem interface { + // ID is a SHA when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch ID() string + + // Description is something we would show in a message e.g. '123as14: push blah' for a commit + Description() string } func (lc *ListContext) GetSelectedItem() ListItem {