Support range selection for reverting commits

This commit is contained in:
Stefan Haller 2025-03-30 13:16:07 +02:00
parent 1c91999f61
commit 945b023eb5
6 changed files with 71 additions and 65 deletions

View file

@ -285,14 +285,14 @@ func (self *CommitCommands) ShowFileContentCmdObj(hash string, filePath string)
return self.cmd.New(cmdArgs).DontLog()
}
// Revert reverts the selected commit by hash. If isMerge is true, we'll pass -m 1
// Revert reverts the selected commits by hash. If isMerge is true, we'll pass -m 1
// to say we want to revert the first parent of the merge commit, which is the one
// people want in 99.9% of cases. In current git versions we could unconditionally
// pass -m 1 even for non-merge commits, but older versions of git choke on it.
func (self *CommitCommands) Revert(hash string, isMerge bool) error {
func (self *CommitCommands) Revert(hashes []string, isMerge bool) error {
cmdArgs := NewGitCmd("revert").
Arg(hash).
ArgIf(isMerge, "-m", "1").
Arg(hashes...).
ToArgv()
return self.cmd.New(cmdArgs).Run()