Skip to content

Commit 7ae1066

Browse files
authored
Merge pull request libgit2#420 from josharian/rebase-operation-type-stringer
Add RebaseOperationReword, and make RebaseOperationType a stringer
2 parents fb438db + 9b850d0 commit 7ae1066

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

rebase.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package git
66
import "C"
77
import (
88
"errors"
9+
"fmt"
910
"runtime"
1011
"unsafe"
1112
)
@@ -16,6 +17,8 @@ type RebaseOperationType uint
1617
const (
1718
// RebaseOperationPick The given commit is to be cherry-picked. The client should commit the changes and continue if there are no conflicts.
1819
RebaseOperationPick RebaseOperationType = C.GIT_REBASE_OPERATION_PICK
20+
// RebaseOperationReword The given commit is to be cherry-picked, but the client should prompt the user to provide an updated commit message.
21+
RebaseOperationReword RebaseOperationType = C.GIT_REBASE_OPERATION_REWORD
1922
// RebaseOperationEdit The given commit is to be cherry-picked, but the client should stop to allow the user to edit the changes before committing them.
2023
RebaseOperationEdit RebaseOperationType = C.GIT_REBASE_OPERATION_EDIT
2124
// RebaseOperationSquash The given commit is to be squashed into the previous commit. The commit message will be merged with the previous message.
@@ -26,6 +29,24 @@ const (
2629
RebaseOperationExec RebaseOperationType = C.GIT_REBASE_OPERATION_EXEC
2730
)
2831

32+
func (t RebaseOperationType) String() string {
33+
switch t {
34+
case RebaseOperationPick:
35+
return "pick"
36+
case RebaseOperationReword:
37+
return "reword"
38+
case RebaseOperationEdit:
39+
return "edit"
40+
case RebaseOperationSquash:
41+
return "squash"
42+
case RebaseOperationFixup:
43+
return "fixup"
44+
case RebaseOperationExec:
45+
return "exec"
46+
}
47+
return fmt.Sprintf("RebaseOperationType(%d)", t)
48+
}
49+
2950
// Special value indicating that there is no currently active operation
3051
var RebaseNoOperation uint = ^uint(0)
3152

0 commit comments

Comments
 (0)