Skip to content

Commit 94c88ed

Browse files
dschogitster
authored andcommitted
Fix submodule squashing into unrelated commit
Actually, I think the issue is pretty independent of submodules; when "git commit" gets an empty parameter, it misinterprets it as a file. So avoid passing an empty parameter to "git commit". Actually, this is a nice cleanup, as MSG_FILE and EDIT_COMMIT were mutually exclusive; use one variable instead Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9674769 commit 94c88ed

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

git-rebase--interactive.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,15 @@ do_next () {
360360
pick_one -n $sha1 || failed=t
361361
case "$(peek_next_command)" in
362362
squash|s)
363-
EDIT_COMMIT=
364363
USE_OUTPUT=output
365364
MSG_OPT=-F
366-
MSG_FILE="$MSG"
365+
EDIT_OR_FILE="$MSG"
367366
cp "$MSG" "$SQUASH_MSG"
368367
;;
369368
*)
370-
EDIT_COMMIT=-e
371369
USE_OUTPUT=
372370
MSG_OPT=
373-
MSG_FILE=
371+
EDIT_OR_FILE=-e
374372
rm -f "$SQUASH_MSG" || exit
375373
cp "$MSG" "$GIT_DIR"/SQUASH_MSG
376374
rm -f "$GIT_DIR"/MERGE_MSG || exit
@@ -384,7 +382,8 @@ do_next () {
384382
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
385383
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
386384
GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
387-
$USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
385+
$USE_OUTPUT git commit --no-verify \
386+
$MSG_OPT "$EDIT_OR_FILE" || failed=t
388387
fi
389388
if test $failed = t
390389
then

t/t3404-rebase-interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ test_expect_success 'submodule rebase setup' '
484484
git commit -a -m "Three changes submodule"
485485
'
486486

487-
test_expect_failure 'submodule rebase -i' '
487+
test_expect_success 'submodule rebase -i' '
488488
FAKE_LINES="1 squash 2 3" git rebase -i A
489489
'
490490

0 commit comments

Comments
 (0)