diff options
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 4 | ||||
-rw-r--r-- | pkg/commands/git_test.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 64f3cd4b1..159c88cca 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -277,8 +277,8 @@ func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCrede } // ResetToCommit reset to commit -func (c *GitCommand) ResetToCommit(sha string) error { - return c.OSCommand.RunCommand(fmt.Sprintf("git reset %s", sha)) +func (c *GitCommand) ResetToCommit(sha string, strength string) error { + return c.OSCommand.RunCommand(fmt.Sprintf("git reset --%s %s", strength, sha)) } // NewBranch create new branch diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 3358be054..0d59c30b7 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -616,12 +616,12 @@ func TestGitCommandResetToCommit(t *testing.T) { gitCmd := NewDummyGitCommand() gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"reset", "78976bc"}, args) + assert.EqualValues(t, []string{"reset", "--hard", "78976bc"}, args) return exec.Command("echo") } - assert.NoError(t, gitCmd.ResetToCommit("78976bc")) + assert.NoError(t, gitCmd.ResetToCommit("78976bc", "hard")) } // TestGitCommandNewBranch is a function. |