Skip to content

Commit 44c33a5

Browse files
committed
Merge branch 'sg/maint-intrebase-msghook' into maint
* sg/maint-intrebase-msghook: rebase -i: remove leftover debugging rebase -i: proper prepare-commit-msg hook argument when squashing
2 parents b8ebe08 + 943cea9 commit 44c33a5

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

git-rebase--interactive.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,23 +314,28 @@ do_next () {
314314

315315
mark_action_done
316316
make_squash_message $sha1 > "$MSG"
317+
failed=f
318+
author_script=$(get_author_ident_from_commit HEAD)
319+
output git reset --soft HEAD^
320+
pick_one -n $sha1 || failed=t
317321
case "$(peek_next_command)" in
318322
squash|s)
319323
EDIT_COMMIT=
320324
USE_OUTPUT=output
325+
MSG_OPT=-F
326+
MSG_FILE="$MSG"
321327
cp "$MSG" "$SQUASH_MSG"
322328
;;
323329
*)
324330
EDIT_COMMIT=-e
325331
USE_OUTPUT=
332+
MSG_OPT=
333+
MSG_FILE=
326334
rm -f "$SQUASH_MSG" || exit
335+
cp "$MSG" "$GIT_DIR"/SQUASH_MSG
336+
rm -f "$GIT_DIR"/MERGE_MSG || exit
327337
;;
328338
esac
329-
330-
failed=f
331-
author_script=$(get_author_ident_from_commit HEAD)
332-
output git reset --soft HEAD^
333-
pick_one -n $sha1 || failed=t
334339
echo "$author_script" > "$DOTEST"/author-script
335340
if test $failed = f
336341
then
@@ -339,7 +344,7 @@ do_next () {
339344
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
340345
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
341346
GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
342-
$USE_OUTPUT git commit --no-verify -F "$MSG" $EDIT_COMMIT || failed=t
347+
$USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
343348
fi
344349
if test $failed = t
345350
then

0 commit comments

Comments
 (0)