summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index 402ec3378..0e974b567 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -221,11 +221,11 @@ func (c *GitCommand) ResetHard() error {
// UpstreamDifferenceCount checks how many pushables/pullables there are for the
// current branch
func (c *GitCommand) UpstreamDifferenceCount() (string, string) {
- pushableCount, err := c.OSCommand.RunCommandWithOutput("git rev-list @{u}..head --count")
+ pushableCount, err := c.OSCommand.RunCommandWithOutput("git rev-list @{u}..HEAD --count")
if err != nil {
return "?", "?"
}
- pullableCount, err := c.OSCommand.RunCommandWithOutput("git rev-list head..@{u} --count")
+ pullableCount, err := c.OSCommand.RunCommandWithOutput("git rev-list HEAD..@{u} --count")
if err != nil {
return "?", "?"
}
@@ -236,7 +236,7 @@ func (c *GitCommand) UpstreamDifferenceCount() (string, string) {
// to the remote branch of the current branch, a map is returned to ease look up
func (c *GitCommand) GetCommitsToPush() map[string]bool {
pushables := map[string]bool{}
- o, err := c.OSCommand.RunCommandWithOutput("git rev-list @{u}..head --abbrev-commit")
+ o, err := c.OSCommand.RunCommandWithOutput("git rev-list @{u}..HEAD --abbrev-commit")
if err != nil {
return pushables
}
@@ -314,8 +314,12 @@ func (c *GitCommand) usingGpg() bool {
}
// Commit commits to git
-func (c *GitCommand) Commit(message string) (*exec.Cmd, error) {
- command := fmt.Sprintf("git commit -m %s", c.OSCommand.Quote(message))
+func (c *GitCommand) Commit(message string, amend bool) (*exec.Cmd, error) {
+ amendParam := ""
+ if amend {
+ amendParam = " --amend"
+ }
+ command := fmt.Sprintf("git commit%s -m %s", amendParam, c.OSCommand.Quote(message))
if c.usingGpg() {
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil
}