{"thread":{"id":"17386","subject":"[Bug] rebase -i squashes submodule changes into unrelated commit","startedAt":"2009-01-27T09:07:31Z","lastAt":"2009-01-27T11:42:31Z","messageCount":3,"participants":["Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102095","messageId":"7vljsxyv58.fsf@gitster.siamese.dyndns.org","threadId":"17386","inReplyTo":null,"subject":"[Bug] rebase -i squashes submodule changes into unrelated commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T09:07:31Z","receivedAt":"2009-01-27T09:07:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Attempting to rebase three-commit series (two regular changes, followed by\none commit that changes what commit is bound for a submodule path) to\nsquash the first two results in a failure; not just the first two commits\nsquashed, but the change to the submodule is also included in the result.\n\nThis failure causes the subsequent step to \"pick\" the change that actually\nchanges the submodule to be applied, because there is no change left to be\napplied.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t3404-rebase-interactive.sh |   26 ++++++++++++++++++++++++++\n 1 files changed, 26 insertions(+), 0 deletions(-)\n\ndiff --git c/t/t3404-rebase-interactive.sh w/t/t3404-rebase-interactive.sh\nindex 2cc8e7a..6ffb9ad 100755\n--- c/t/t3404-rebase-interactive.sh\n+++ w/t/t3404-rebase-interactive.sh\n@@ -462,4 +462,30 @@ test_expect_success 'do \"noop\" when there is nothing to cherry-pick' '\n \n '\n \n+test_expect_success 'submodule rebase setup' '\n+\tgit checkout A &&\n+\tmkdir sub &&\n+\t(\n+\t\tcd sub && git init && >elif &&\n+\t\tgit add elif && git commit -m \"submodule initial\"\n+\t) &&\n+\techo 1 >file1 &&\n+\tgit add file1 sub\n+\ttest_tick &&\n+\tgit commit -m \"One\" &&\n+\techo 2 >file1 &&\n+\ttest_tick &&\n+\tgit commit -a -m \"Two\" &&\n+\t(\n+\t\tcd sub && echo 3 >elif &&\n+\t\tgit commit -a -m \"submodule second\"\n+\t) &&\n+\ttest_tick &&\n+\tgit commit -a -m \"Three changes submodule\"\n+'\n+\n+test_expect_failure 'submodule rebase -i' '\n+\tFAKE_LINES=\"1 squash 2 3\" git rebase -i A\n+'\n+\n test_done\n"},{"id":"102096","messageId":"7vd4e9yujd.fsf@gitster.siamese.dyndns.org","threadId":"17386","inReplyTo":"7vljsxyv58.fsf@gitster.siamese.dyndns.org","subject":"Re: [Bug] rebase -i squashes submodule changes into unrelated commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T09:20:38Z","receivedAt":"2009-01-27T09:20:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Attempting to rebase three-commit series (two regular changes, followed by\n> one commit that changes what commit is bound for a submodule path) to\n> squash the first two results in a failure; not just the first two commits\n> squashed, but the change to the submodule is also included in the result.\n>\n> This failure causes the subsequent step to \"pick\" the change that actually\n> changes the submodule to be applied, because there is no change left to be\n> applied.\n\nSorry, an obvious typo is here: s/to be applied,/to fail,/;\n"},{"id":"102107","messageId":"alpine.DEB.1.00.0901271241010.14855@racer","threadId":"17386","inReplyTo":"7vljsxyv58.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Fix submodule squashing into unrelated commit","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T11:42:31Z","receivedAt":"2009-01-27T11:42:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nActually, I think the issue is pretty independent of submodules; when\n\"git commit\" gets an empty parameter, it misinterprets it as a file.\n\nSo avoid passing an empty parameter to \"git commit\".\n\nActually, this is a nice cleanup, as MSG_FILE and EDIT_COMMIT were mutually\nexclusive; use one variable instead\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tWe might want to safeguard \"git commit\", too.\n\n git-rebase--interactive.sh    |    9 ++++-----\n t/t3404-rebase-interactive.sh |    2 +-\n 2 files changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 002929e..3ac7162 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -373,17 +373,15 @@ do_next () {\n \t\tpick_one -n $sha1 || failed=t\n \t\tcase \"$(peek_next_command)\" in\n \t\tsquash|s)\n-\t\t\tEDIT_COMMIT=\n \t\t\tUSE_OUTPUT=output\n \t\t\tMSG_OPT=-F\n-\t\t\tMSG_FILE=\"$MSG\"\n+\t\t\tEDIT_OR_FILE=\"$MSG\"\n \t\t\tcp \"$MSG\" \"$SQUASH_MSG\"\n \t\t\t;;\n \t\t*)\n-\t\t\tEDIT_COMMIT=-e\n \t\t\tUSE_OUTPUT=\n \t\t\tMSG_OPT=\n-\t\t\tMSG_FILE=\n+\t\t\tEDIT_OR_FILE=-e\n \t\t\trm -f \"$SQUASH_MSG\" || exit\n \t\t\tcp \"$MSG\" \"$GIT_DIR\"/SQUASH_MSG\n \t\t\trm -f \"$GIT_DIR\"/MERGE_MSG || exit\n@@ -397,7 +395,8 @@ do_next () {\n \t\t\tGIT_AUTHOR_NAME=\"$GIT_AUTHOR_NAME\" \\\n \t\t\tGIT_AUTHOR_EMAIL=\"$GIT_AUTHOR_EMAIL\" \\\n \t\t\tGIT_AUTHOR_DATE=\"$GIT_AUTHOR_DATE\" \\\n-\t\t\t$USE_OUTPUT git commit --no-verify $MSG_OPT \"$MSG_FILE\" $EDIT_COMMIT || failed=t\n+\t\t\t$USE_OUTPUT git commit --no-verify \\\n+\t\t\t\t$MSG_OPT \"$EDIT_OR_FILE\" || failed=t\n \t\tfi\n \t\tif test $failed = t\n \t\tthen\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 6ffb9ad..4becc55 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -484,7 +484,7 @@ test_expect_success 'submodule rebase setup' '\n \tgit commit -a -m \"Three changes submodule\"\n '\n \n-test_expect_failure 'submodule rebase -i' '\n+test_expect_success 'submodule rebase -i' '\n \tFAKE_LINES=\"1 squash 2 3\" git rebase -i A\n '\n \n-- \n1.6.1.482.g7d54be\n"}]}