{"thread":{"id":"30179","subject":"[PATCH] rebase -i continue: Don't skip submodule only commits","startedAt":"2012-04-07T10:20:53Z","lastAt":"2012-04-11T18:23:16Z","messageCount":3,"participants":["John Keeping","Junio C Hamano","Jens Lehmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"188728","messageId":"1333794053-22226-1-git-send-email-john@keeping.me.uk","threadId":"30179","inReplyTo":null,"subject":"[PATCH] rebase -i continue: Don't skip submodule only commits","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2012-04-07T10:20:53Z","receivedAt":"2012-04-07T10:20:53Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"When git-rebase--interactive stops due to a conflict and the only change\nto be committed is in a submodule, the test for whether there is\nanything to be committed ignores the staged submodule change.  This\nleads rebase to skip creating the commit for the change.\n\nWhile unstaged submodule changes should be ignored to avoid needing to\nupdate submodules during a rebase, it is safe to remove the\n--ignore-submodules option to diff-index because --cached ensures that\nit is only checking the index.  This was discussed in [1] and a test is\nincluded to ensure that unstaged changes are still ignored correctly.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/188713\n\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\n git-rebase--interactive.sh    |    2 +-\n t/t3404-rebase-interactive.sh |   30 ++++++++++++++++++++++++++++++\n 2 files changed, 31 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 5812222..4546749 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -672,7 +672,7 @@ rearrange_squash () {\n case \"$action\" in\n continue)\n \t# do we have anything to commit?\n-\tif git diff-index --cached --quiet --ignore-submodules HEAD --\n+\tif git diff-index --cached --quiet HEAD --\n \tthen\n \t\t: Nothing to commit -- skip this\n \telse\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex b981572..7fd2127 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -624,8 +624,38 @@ test_expect_success 'submodule rebase -i' '\n \tFAKE_LINES=\"1 squash 2 3\" git rebase -i A\n '\n \n+test_expect_success 'submodule conflict setup' '\n+\tgit tag submodule-base &&\n+\tgit checkout HEAD^ &&\n+\t(\n+\t\tcd sub && git checkout HEAD^ && echo 4 >elif &&\n+\t\tgit add elif && git commit -m \"submodule conflict\"\n+\t) &&\n+\tgit add sub &&\n+\ttest_tick &&\n+\tgit commit -m \"Conflict in submodule\" &&\n+\tgit tag submodule-topic\n+'\n+\n+test_expect_success 'rebase -i continue with only submodule staged' '\n+\ttest_must_fail git rebase -i submodule-base &&\n+\tgit add sub &&\n+\tgit rebase --continue &&\n+\ttest $(git rev-parse submodule-base) != $(git rev-parse HEAD)\n+'\n+\n+test_expect_success 'rebase -i continue with unstaged submodule' '\n+\tgit checkout submodule-topic &&\n+\tgit reset --hard &&\n+\ttest_must_fail git rebase -i submodule-base &&\n+\tgit reset &&\n+\tgit rebase --continue &&\n+\ttest $(git rev-parse submodule-base) = $(git rev-parse HEAD)\n+'\n+\n test_expect_success 'avoid unnecessary reset' '\n \tgit checkout master &&\n+\tgit reset --hard &&\n \ttest-chmtime =123456789 file3 &&\n \tgit update-index --refresh &&\n \tHEAD=$(git rev-parse HEAD) &&\n-- \n1.7.8.5\n"},{"id":"188823","messageId":"7vpqbgtv4l.fsf@alter.siamese.dyndns.org","threadId":"30179","inReplyTo":"1333794053-22226-1-git-send-email-john@keeping.me.uk","subject":"Re: [PATCH] rebase -i continue: Don't skip submodule only commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-09T22:09:46Z","receivedAt":"2012-04-09T22:09:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Keeping <john@keeping.me.uk> writes:\n\n> When git-rebase--interactive stops due to a conflict and the only change\n> to be committed is in a submodule, the test for whether there is\n> anything to be committed ignores the staged submodule change.  This\n> leads rebase to skip creating the commit for the change.\n>\n> While unstaged submodule changes should be ignored to avoid needing to\n> update submodules during a rebase, it is safe to remove the\n> --ignore-submodules option to diff-index because --cached ensures that\n> it is only checking the index.  This was discussed in [1] and a test is\n> included to ensure that unstaged changes are still ignored correctly.\n>\n> [1] http://thread.gmane.org/gmane.comp.version-control.git/188713\n>\n> Signed-off-by: John Keeping <john@keeping.me.uk>\n> ---\n\nVery well explained and sensible.\n"},{"id":"189010","messageId":"4F85CC14.6060106@web.de","threadId":"30179","inReplyTo":"7vpqbgtv4l.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] rebase -i continue: Don't skip submodule only commits","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-04-11T18:23:16Z","receivedAt":"2012-04-11T18:23:16Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 10.04.2012 00:09, schrieb Junio C Hamano:\n> John Keeping <john@keeping.me.uk> writes:\n> \n>> When git-rebase--interactive stops due to a conflict and the only change\n>> to be committed is in a submodule, the test for whether there is\n>> anything to be committed ignores the staged submodule change.  This\n>> leads rebase to skip creating the commit for the change.\n>>\n>> While unstaged submodule changes should be ignored to avoid needing to\n>> update submodules during a rebase, it is safe to remove the\n>> --ignore-submodules option to diff-index because --cached ensures that\n>> it is only checking the index.  This was discussed in [1] and a test is\n>> included to ensure that unstaged changes are still ignored correctly.\n>>\n>> [1] http://thread.gmane.org/gmane.comp.version-control.git/188713\n>>\n>> Signed-off-by: John Keeping <john@keeping.me.uk>\n>> ---\n> \n> Very well explained and sensible.\n\nAn obvious Ack from me and many thanks to John for providing the test\ncases I didn't find the time to write!\n"}]}