rebase: make RebaseOperationType a fmt.Stringer

Helps with debugging.
This commit is contained in:
Josh Bleecher Snyder 2018-01-21 13:46:54 -08:00
parent 21fd4ad5f6
commit 9b850d084e
1 changed files with 19 additions and 0 deletions

View File

@ -6,6 +6,7 @@ package git
import "C"
import (
"errors"
"fmt"
"runtime"
"unsafe"
)
@ -28,6 +29,24 @@ const (
RebaseOperationExec RebaseOperationType = C.GIT_REBASE_OPERATION_EXEC
)
func (t RebaseOperationType) String() string {
switch t {
case RebaseOperationPick:
return "pick"
case RebaseOperationReword:
return "reword"
case RebaseOperationEdit:
return "edit"
case RebaseOperationSquash:
return "squash"
case RebaseOperationFixup:
return "fixup"
case RebaseOperationExec:
return "exec"
}
return fmt.Sprintf("RebaseOperationType(%d)", t)
}
// Special value indicating that there is no currently active operation
var RebaseNoOperation uint = ^uint(0)