summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-16 22:01:14 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-16 22:24:54 +1000
commitdb826b3c8795e47e3471ab76bc4bcb131892c224 (patch)
tree37938ead603d4da7697ba4391f91e173787b2b17 /pkg/commands
parentbe658e7d64c8d120a6c7ca9c59cbb05957135c1d (diff)
add keybinding to create new branch off of commit
retain focus in commits panel surface prompt errors better description
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/commit.go6
-rw-r--r--pkg/commands/git.go4
2 files changed, 8 insertions, 2 deletions
diff --git a/pkg/commands/commit.go b/pkg/commands/commit.go
index ea4192b33..f8f7491b4 100644
--- a/pkg/commands/commit.go
+++ b/pkg/commands/commit.go
@@ -1,5 +1,7 @@
package commands
+import "fmt"
+
// Commit : A git commit
type Commit struct {
Sha string
@@ -18,3 +20,7 @@ func (c *Commit) ShortSha() string {
}
return c.Sha[:8]
}
+
+func (c *Commit) NameWithSha() string {
+ return fmt.Sprintf("%s %s", c.Sha[:7], c.Name)
+}
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index f4fb4a424..b52c989d7 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -401,8 +401,8 @@ func (c *GitCommand) ResetToCommit(sha string, strength string, options RunComma
}
// NewBranch create new branch
-func (c *GitCommand) NewBranch(name string, baseBranch string) error {
- return c.OSCommand.RunCommand("git checkout -b %s %s", name, baseBranch)
+func (c *GitCommand) NewBranch(name string, base string) error {
+ return c.OSCommand.RunCommand("git checkout -b %s %s", name, base)
}
// CurrentBranchName get the current branch name and displayname.