1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

commands/git : add tests on SquashPreviousTwoCommits

This commit is contained in:
Anthony HAMON
2018-09-12 20:43:03 +02:00
parent 79940b7ba9
commit 65a24d70c3
2 changed files with 65 additions and 3 deletions

View File

@ -327,12 +327,11 @@ func (c *GitCommand) Push(branchName string, force bool) error {
// retaining the message of the higher commit
func (c *GitCommand) SquashPreviousTwoCommits(message string) error {
// TODO: test this
err := c.OSCommand.RunCommand("git reset --soft HEAD^")
if err != nil {
if err := c.OSCommand.RunCommand("git reset --soft HEAD^"); err != nil {
return err
}
// TODO: if password is required, we need to return a subprocess
return c.OSCommand.RunCommand("git commit --amend -m " + c.OSCommand.Quote(message))
return c.OSCommand.RunCommand(fmt.Sprintf("git commit --amend -m %s", c.OSCommand.Quote(message)))
}
// SquashFixupCommit squashes a 'FIXUP' commit into the commit beneath it,