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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jan 27, 2009 at 12:42 UTC
94c88edef7a69299e12248b910752f1fc26f12d6
2 files changed
+5
-6
git-rebase--interactive.sh
+4
-5
@@ -360,17 +360,15 @@ do_next () {
360
pick_one -n $sha1 || failed=t
361
case "$(peek_next_command)" in
362
squash|s)
363
- EDIT_COMMIT=
363
USE_OUTPUT=output
364
MSG_OPT=-F
366
- MSG_FILE="$MSG"
365
+ EDIT_OR_FILE="$MSG"
366
cp "$MSG" "$SQUASH_MSG"
367
;;
368
*)
370
- EDIT_COMMIT=-e
369
USE_OUTPUT=
370
MSG_OPT=
373
- MSG_FILE=
371
+ EDIT_OR_FILE=-e
372
rm -f "$SQUASH_MSG" || exit
373
cp "$MSG" "$GIT_DIR"/SQUASH_MSG
374
rm -f "$GIT_DIR"/MERGE_MSG || exit
@@ -384,7 +382,8 @@ do_next () {
382
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
383
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
384
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
387
fi
388
if test $failed = t
389
then
t/t3404-rebase-interactive.sh
+1
-1
@@ -484,7 +484,7 @@ test_expect_success 'submodule rebase setup' '
484
git commit -a -m "Three changes submodule"
485
'
486
487
-test_expect_failure 'submodule rebase -i' '
487
+test_expect_success 'submodule rebase -i' '
488
FAKE_LINES="1 squash 2 3" git rebase -i A
489
'
490