Skip to content

Commit

Permalink
[#674] Tune git revert command arguments to prevent auto-commit
Browse files Browse the repository at this point in the history
So that we can use our own commit message when reverting
- add option "--no-commit" to git revert command
- tune git package tests accordingly
  • Loading branch information
mengdaming committed Oct 1, 2024
1 parent 7f8b117 commit 25cfa77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vcs/git/git_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (g *gitImpl) RevertLocal(path string) error {
// Current implementation uses a direct call to git
func (g *gitImpl) RollbackLastCommit() error {
report.PostInfo("Reverting changes")
return g.traceGit("revert", "--no-gpg-sign", "--no-edit", "HEAD")
return g.traceGit("revert", "--no-gpg-sign", "--no-edit", "--no-commit", "HEAD")
}

// Push runs a git push operation.
Expand Down
4 changes: 2 additions & 2 deletions src/vcs/git/git_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,13 @@ func Test_git_revert(t *testing.T) {
"git revert command call succeeds",
nil,
false,
[]string{"revert", "--no-gpg-sign", "--no-edit", "HEAD"},
[]string{"revert", "--no-gpg-sign", "--no-edit", "--no-commit", "HEAD"},
},
{
"git revert command call fails",
errors.New("git revert error"),
true,
[]string{"revert", "--no-gpg-sign", "--no-edit", "HEAD"},
[]string{"revert", "--no-gpg-sign", "--no-edit", "--no-commit", "HEAD"},
},
}
for _, tt := range testFlags {
Expand Down

0 comments on commit 25cfa77

Please sign in to comment.