Skip to contentSkip to conversation

Avoid update hook during git-rebase --interactive

PATCH In review Shawn O. Pearce 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Avoid update hook during git-rebase --interactive

If we are rebasing changes that contain potential whitespace errors that our .git/hooks/pre-commit hook looks for and fails on then git-commit will fail to commit that change. This causes git-rebase--interactive to squash commits together, even though it was not requested to do so by the todo file.

Passing --no-verify to git-commit makes git-rebase -i behave more like git-rebase normally would in such conditions, providing more consistent behavior between the different rebase implementations.

---

This bug has bitten me more than once. One could argue that the pre-commit hook should be running, to prevent you from rebasing a series that has crappy whitespace, but git-rebase without -m and without -i will let you rebase such a series without stopping you, as git-am doesn't execute the pre-commit hook.

 git-rebase--interactive.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
git-rebase--interactive.sh +2 -2
index cd7e43f..b846ea8 100755
@@ -296,7 +296,7 @@ do_next () {
 			GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
 			GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
 			GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
-			$USE_OUTPUT git commit -F "$MSG" $EDIT_COMMIT
+			$USE_OUTPUT git commit --no-verify -F "$MSG" $EDIT_COMMIT
 			;;
 		t)
 			cp "$MSG" "$GIT_DIR"/MERGE_MSG
@@ -372,7 +372,7 @@ do
 			test ! -f "$DOTEST"/amend || git reset --soft HEAD^
 		} &&
 		export GIT_AUTHOR_NAME GIT_AUTHOR_NAME GIT_AUTHOR_DATE &&
-		git commit -F "$DOTEST"/message -e
+		git commit --no-verify -F "$DOTEST"/message -e
 
 		require_clean_work_tree
 		do_rest
Signature · 1 line
1.5.4.rc0.1155.g12ed9