From 21fd4ad5f6ee67580fcf831917e54e18b074b5ed Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Sun, 21 Jan 2018 13:46:08 -0800 Subject: [PATCH 1/2] rebase: add RebaseOperationReword --- rebase.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rebase.go b/rebase.go index 5206fca..4517dde 100644 --- a/rebase.go +++ b/rebase.go @@ -16,6 +16,8 @@ type RebaseOperationType uint const ( // RebaseOperationPick The given commit is to be cherry-picked. The client should commit the changes and continue if there are no conflicts. RebaseOperationPick RebaseOperationType = C.GIT_REBASE_OPERATION_PICK + // RebaseOperationReword The given commit is to be cherry-picked, but the client should prompt the user to provide an updated commit message. + RebaseOperationReword RebaseOperationType = C.GIT_REBASE_OPERATION_REWORD // 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. RebaseOperationEdit RebaseOperationType = C.GIT_REBASE_OPERATION_EDIT // RebaseOperationSquash The given commit is to be squashed into the previous commit. The commit message will be merged with the previous message. From 9b850d084e13e0376f3fe8cfb556d2e7b51f398f Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Sun, 21 Jan 2018 13:46:54 -0800 Subject: [PATCH 2/2] rebase: make RebaseOperationType a fmt.Stringer Helps with debugging. --- rebase.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rebase.go b/rebase.go index 4517dde..d29e183 100644 --- a/rebase.go +++ b/rebase.go @@ -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)