@matheusbsbs / matheus-bagliano / commits / 7c4188360a
Fork 0

rebase -i: proper prepare-commit-msg hook argument when squashing

One would expect that the prepare-commit-msg hook gets 'squash' as the second argument when squashing commits with 'rebase -i'. However, that was not the case, as it got 'merge' instead. This patch fixes the problem. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

SZEDER Gábor committed Oct 3, 2008 at 02:08 UTC 7c4188360ac157217046dd99f4d98a4bf17907a8
1 file changed +11 -6
git-rebase--interactive.sh
+11 -6
@@ -304,23 +304,28 @@ do_next () {
304
305 mark_action_done
306 make_squash_message $sha1 > "$MSG"
307 + failed=f
308 + author_script=$(get_author_ident_from_commit HEAD)
309 + output git reset --soft HEAD^
310 + pick_one -n $sha1 || failed=t
311 case "$(peek_next_command)" in
312 squash|s)
313 EDIT_COMMIT=
314 USE_OUTPUT=output
315 + MSG_OPT=-F
316 + MSG_FILE="$MSG"
317 cp "$MSG" "$SQUASH_MSG"
318 ;;
319 *)
320 EDIT_COMMIT=-e
321 USE_OUTPUT=
322 + MSG_OPT=
323 + MSG_FILE=
324 rm -f "$SQUASH_MSG" || exit
325 + cp -v "$MSG" "$GIT_DIR"/SQUASH_MSG
326 + rm -f "$GIT_DIR"/MERGE_MSG || exit
327 ;;
328 esac
319 -
320 - failed=f
321 - author_script=$(get_author_ident_from_commit HEAD)
322 - output git reset --soft HEAD^
323 - pick_one -n $sha1 || failed=t
329 echo "$author_script" > "$DOTEST"/author-script
330 if test $failed = f
331 then
@@ -329,7 +334,7 @@ do_next () {
334 GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
335 GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
336 GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
332 - $USE_OUTPUT git commit --no-verify -F "$MSG" $EDIT_COMMIT || failed=t
337 + $USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
338 fi
339 if test $failed = t
340 then