Code

Fix submodule squashing into unrelated commit
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Tue, 27 Jan 2009 11:42:31 +0000 (12:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Jan 2009 22:54:58 +0000 (14:54 -0800)
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>
git-rebase--interactive.sh
t/t3404-rebase-interactive.sh

index 8ed2244819d0950ddf1ffaa151b4d46bdc8b6db4..1ceb57ae8302dc3f0673779cf60f70df5c26a64d 100755 (executable)
@@ -360,17 +360,15 @@ do_next () {
                pick_one -n $sha1 || failed=t
                case "$(peek_next_command)" in
                squash|s)
-                       EDIT_COMMIT=
                        USE_OUTPUT=output
                        MSG_OPT=-F
-                       MSG_FILE="$MSG"
+                       EDIT_OR_FILE="$MSG"
                        cp "$MSG" "$SQUASH_MSG"
                        ;;
                *)
-                       EDIT_COMMIT=-e
                        USE_OUTPUT=
                        MSG_OPT=
-                       MSG_FILE=
+                       EDIT_OR_FILE=-e
                        rm -f "$SQUASH_MSG" || exit
                        cp "$MSG" "$GIT_DIR"/SQUASH_MSG
                        rm -f "$GIT_DIR"/MERGE_MSG || exit
@@ -384,7 +382,8 @@ do_next () {
                        GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
                        GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
                        GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
-                       $USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
+                       $USE_OUTPUT git commit --no-verify \
+                               $MSG_OPT "$EDIT_OR_FILE" || failed=t
                fi
                if test $failed = t
                then
index 6ffb9ad794196da6f57853834bc6007edead8006..4becc5513dc3f46b73fbe8d7ea09a4c2912aa0a2 100755 (executable)
@@ -484,7 +484,7 @@ test_expect_success 'submodule rebase setup' '
        git commit -a -m "Three changes submodule"
 '
 
-test_expect_failure 'submodule rebase -i' '
+test_expect_success 'submodule rebase -i' '
        FAKE_LINES="1 squash 2 3" git rebase -i A
 '