{"thread":{"id":"24535","subject":"[PATCH] Fix git rebase --continue to work with touched files","startedAt":"2010-07-27T10:06:38Z","lastAt":"2010-07-27T21:29:24Z","messageCount":5,"participants":["David D. Kilzer","Johannes Schindelin","Ævar Arnfjörð Bjarmason","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"146460","messageId":"1280225198-4539-1-git-send-email-ddkilzer@kilzer.net","threadId":"24535","inReplyTo":null,"subject":"[PATCH] Fix git rebase --continue to work with touched files","fromName":"David D. Kilzer","fromEmail":"ddkilzer@kilzer.net","sentAt":"2010-07-27T10:06:38Z","receivedAt":"2010-07-27T10:06:38Z","isPatch":true,"sender":{"key":"ddkilzer@kilzer.net","avatar":"https://avatars.githubusercontent.com/u/263571?v=4"},"body":"When performing a non-interactive rebase, sometimes\n\"git rebase --continue\" will fail if an unmodified file is\ntouched in the working directory:\n\n    You must edit all merge conflicts and then\n    mark them as resolved using git add\n\nThis is caused by \"git diff-files\" reporting a difference\nbetween the index and the filesystem:\n\n    :100644 100644 d00491...... 000000...... M\tfile\n\nThe fix is to run \"git update-index --refresh\" before\n\"git diff-files\" as is done in git-rebase--interactive.\n\nSigned-off-by: David D. Kilzer <ddkilzer@kilzer.net>\n---\nThe reason for the while loop in the test is that this bug only\nreproduces about half of the time on my Mac Pro with Mac OS X\n10.6.4.  I used 4 loops to make sure the test fails without the\nfix.\n\nI also put the test in a separate file since t3400-rebase.sh\nchanged a lot in e877a4c, and to make it clear what is required\nto reproduce the bug.\n\n git-rebase.sh              |    1 +\n t/t3418-rebase-continue.sh |   40 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 41 insertions(+), 0 deletions(-)\n create mode 100755 t/t3418-rebase-continue.sh\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex ab4afa7..2d88742 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -208,6 +208,7 @@ do\n \t\ttest -d \"$dotest\" -o -d \"$GIT_DIR\"/rebase-apply ||\n \t\t\tdie \"No rebase in progress?\"\n \n+\t\tgit update-index --ignore-submodules --refresh &&\n \t\tgit diff-files --quiet --ignore-submodules || {\n \t\t\techo \"You must edit all merge conflicts and then\"\n \t\t\techo \"mark them as resolved using git add\"\ndiff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh\nnew file mode 100755\nindex 0000000..435560c\n--- /dev/null\n+++ b/t/t3418-rebase-continue.sh\n@@ -0,0 +1,40 @@\n+#!/bin/sh\n+\n+test_description='git rebase --continue should work with touched files'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'setup' '\n+\techo 1 >F1 &&\n+\tgit add F1 &&\n+\tgit commit -m \"commit: new file F1\" &&\n+\n+\techo 2 >F2 &&\n+\tgit add F2 &&\n+\tgit commit -m \"commit: new file F2\" &&\n+\n+\tgit checkout -b topic HEAD^ &&\n+\n+\techo 22 > F2 &&\n+\tgit add F2 &&\n+\tgit commit -m \"commit: new file F2 on topic branch\" &&\n+\n+\tgit checkout master\n+'\n+\n+\n+test_expect_success 'rebase --continue works with touched file' '\n+\tcount=1\n+\twhile test \"$count\" -le 4\n+\tdo\n+\t\tgit branch topic$count topic &&\n+\t\ttest_must_fail git rebase --onto master master topic$count &&\n+\t\techo \"Resolved\" >F2 &&\n+\t\tgit add F2 &&\n+\t\ttouch F1 &&\n+\t\tgit rebase --continue || exit 1\n+\t\tcount=$(($count + 1))\n+\tdone\n+'\n+\n+test_done\n-- \n1.7.1.1.36.g07b1c\n"},{"id":"146461","messageId":"alpine.DEB.1.00.1007271215420.2983@bonsai2","threadId":"24535","inReplyTo":"1280225198-4539-1-git-send-email-ddkilzer@kilzer.net","subject":"Re: [PATCH] Fix git rebase --continue to work with touched files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-07-27T10:16:01Z","receivedAt":"2010-07-27T10:16:01Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jul 2010, David D. Kilzer wrote:\n\n> When performing a non-interactive rebase, sometimes\n> \"git rebase --continue\" will fail if an unmodified file is\n> touched in the working directory:\n> \n>     You must edit all merge conflicts and then\n>     mark them as resolved using git add\n> \n> This is caused by \"git diff-files\" reporting a difference\n> between the index and the filesystem:\n> \n>     :100644 100644 d00491...... 000000...... M\tfile\n> \n> The fix is to run \"git update-index --refresh\" before\n> \"git diff-files\" as is done in git-rebase--interactive.\n> \n> Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>\n\nACK!\n\n... and thanks!\nDscho\n"},{"id":"146463","messageId":"AANLkTikEAtttvFY-M39eaoiPM600nvfunxBn7DmxHHQv@mail.gmail.com","threadId":"24535","inReplyTo":"1280225198-4539-1-git-send-email-ddkilzer@kilzer.net","subject":"Re: [PATCH] Fix git rebase --continue to work with touched files","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-27T10:20:46Z","receivedAt":"2010-07-27T10:20:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Jul 27, 2010 at 10:06, David D. Kilzer <ddkilzer@kilzer.net> wrote:\n> +test_expect_success 'setup' '\n> +       echo 1 >F1 &&\n> +       git add F1 &&\n> +       git commit -m \"commit: new file F1\" &&\n> +\n> +       echo 2 >F2 &&\n> +       git add F2 &&\n> +       git commit -m \"commit: new file F2\" &&\n\nUse test_commit for these:\n\n    test_commit \"commit: new file F1\" F1 1 &&\n    test_commit \"commit: new file F2\" F2 2 &&\n    ...\n"},{"id":"146515","messageId":"201007272153.36646.j6t@kdbg.org","threadId":"24535","inReplyTo":"1280225198-4539-1-git-send-email-ddkilzer@kilzer.net","subject":"Re: [PATCH] Fix git rebase --continue to work with touched files","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-07-27T19:53:36Z","receivedAt":"2010-07-27T19:53:36Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Dienstag, 27. Juli 2010, David D. Kilzer wrote:\n> +test_expect_success 'rebase --continue works with touched file' '\n> +\tcount=1\n> +\twhile test \"$count\" -le 4\n> +\tdo\n> +\t\tgit branch topic$count topic &&\n> +\t\ttest_must_fail git rebase --onto master master topic$count &&\n> +\t\techo \"Resolved\" >F2 &&\n> +\t\tgit add F2 &&\n> +\t\ttouch F1 &&\n> +\t\tgit rebase --continue || exit 1\n\nexit from a test is a big no-no. But I think you can reproduce the issue \nreliably and get rid of the entire loop if you use test-chmtime instead of \ntouch:\n\n\t\ttest-chmtime =-60 F1 &&\n\ni.e. set the modification time back one minute.\n\n> +\t\tcount=$(($count + 1))\n> +\tdone\n> +'\n> +\n> +test_done\n\n-- Hannes\n"},{"id":"146540","messageId":"783007.41425.qm@web30007.mail.mud.yahoo.com","threadId":"24535","inReplyTo":"201007272153.36646.j6t@kdbg.org","subject":"Re: [PATCH] Fix git rebase --continue to work with touched files","fromName":"David D. Kilzer","fromEmail":"ddkilzer@kilzer.net","sentAt":"2010-07-27T21:29:24Z","receivedAt":"2010-07-27T21:29:24Z","isPatch":true,"sender":{"key":"ddkilzer@kilzer.net","avatar":"https://avatars.githubusercontent.com/u/263571?v=4"},"body":"On Tue, July 27, 2010 at 12:53:36 PM, Johannes Sixt wrote:\n \n> On Dienstag, 27. Juli 2010, David D. Kilzer wrote:\n> > +test_expect_success  'rebase --continue works with touched file' '\n> > +     count=1\n> > +    while test \"$count\" -le 4\n> >  +    do\n> > +        git branch  topic$count topic &&\n> > +         test_must_fail git rebase --onto master master topic$count &&\n> >  +        echo \"Resolved\" >F2 &&\n> >  +        git add F2 &&\n> >  +        touch F1 &&\n> >  +        git rebase --continue || exit  1\n> \n> exit from a test is a big no-no. But I think you can reproduce the  issue \n> reliably and get rid of the entire loop if you use test-chmtime  instead of \n> touch:\n> \n>         test-chmtime  =-60 F1 &&\n> \n> i.e. set the modification time back one  minute.\n\n\nThat works great!  Thanks!\n\nDave\n"}]}