{"thread":{"id":"8924","subject":"[PATCH 1/3] rebase -i: handle --continue more like non-interactive rebase","startedAt":"2007-07-08T02:01:29Z","lastAt":"2007-08-01T22:40:14Z","messageCount":9,"participants":["Johannes Schindelin","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"46727","messageId":"Pine.LNX.4.64.0707080300440.4093@racer.site","threadId":"8924","inReplyTo":null,"subject":"[PATCH 1/3] rebase -i: handle --continue more like non-interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-08T02:01:29Z","receivedAt":"2007-07-08T02:01:29Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nNon-interactive rebase requires the working tree to be clean, but\napplies what is in the index without requiring the user to do it\nherself.  Imitate that, but (since we are interactive, after all)\nfire up an editor with the commit message.\n\nIt also fixes a subtle bug: a forgotten \"continue\" was removed, which\nled to an infinite loop when continuing without remaining patches.\n\nBoth issues noticed by Frank Lichtenheld.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-rebase--interactive.sh    |   25 ++++++++++++++++---------\n t/t3404-rebase-interactive.sh |   16 +++++++++++++++-\n 2 files changed, 31 insertions(+), 10 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c2a969..67f2ee2 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -59,6 +59,10 @@ make_patch () {\n }\n \n die_with_patch () {\n+\ttest -f \"$DOTEST\"/message ||\n+\t\tgit cat-file commit $sha1 | sed \"1,/^$/d\" > \"$DOTEST\"/message\n+\ttest -f \"$DOTEST\"/author-script ||\n+\t\tget_author_ident_from_commit $sha1 > \"$DOTEST\"/author-script\n \tmake_patch \"$1\"\n \tdie \"$2\"\n }\n@@ -140,10 +144,7 @@ pick_one_preserving_merges () {\n \t\t\tif ! git merge $STRATEGY -m \"$msg\" $new_parents\n \t\t\tthen\n \t\t\t\techo \"$msg\" > \"$GIT_DIR\"/MERGE_MSG\n-\t\t\t\twarn Error redoing merge $sha1\n-\t\t\t\twarn\n-\t\t\t\twarn After fixup, please use\n-\t\t\t\tdie \"$author_script git commit\"\n+\t\t\t\tdie Error redoing merge $sha1\n \t\t\tfi\n \t\t\t;;\n \t\t*)\n@@ -154,11 +155,12 @@ pick_one_preserving_merges () {\n }\n \n do_next () {\n+\ttest -f \"$DOTEST\"/message && rm \"$DOTEST\"/message\n+\ttest -f \"$DOTEST\"/author-script && rm \"$DOTEST\"/author-script\n \tread command sha1 rest < \"$TODO\"\n \tcase \"$command\" in\n \t\\#|'')\n \t\tmark_action_done\n-\t\tcontinue\n \t\t;;\n \tpick)\n \t\tcomment_for_reflog pick\n@@ -201,6 +203,7 @@ do_next () {\n \t\tgit cat-file commit $sha1 | sed -e '1,/^$/d' >> \"$MSG\"\n \t\tgit reset --soft HEAD^\n \t\tauthor_script=$(get_author_ident_from_commit $sha1)\n+\t\techo \"$author_script\" > \"$DOTEST\"/author-script\n \t\tcase $failed in\n \t\tf)\n \t\t\t# This is like --amend, but with a different message\n@@ -212,10 +215,6 @@ do_next () {\n \t\t\tcp \"$MSG\" \"$GIT_DIR\"/MERGE_MSG\n \t\t\twarn\n \t\t\twarn \"Could not apply $sha1... $rest\"\n-\t\t\twarn \"After you fixed that, commit the result with\"\n-\t\t\twarn\n-\t\t\twarn \"  $(echo $author_script | tr '\\012' ' ') \\\\\"\n-\t\t\twarn \"\t  git commit -F \\\"$GIT_DIR\\\"/MERGE_MSG -e\"\n \t\t\tdie_with_patch $sha1 \"\"\n \t\tesac\n \t\t;;\n@@ -265,6 +264,14 @@ do\n \n \t\ttest -d \"$DOTEST\" || die \"No interactive rebase running\"\n \n+\t\t# commit if necessary\n+\t\tgit rev-parse --verify HEAD > /dev/null &&\n+\t\tgit update-index --refresh &&\n+\t\tgit diff-files --quiet &&\n+\t\t! git diff-index --cached --quiet HEAD &&\n+\t\t. \"$DOTEST\"/author-script &&\n+\t\tgit commit -F \"$DOTEST\"/message -e\n+\n \t\trequire_clean_work_tree\n \t\tdo_rest\n \t\t;;\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 883cf29..c251336 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -63,7 +63,10 @@ test_expect_success 'setup' '\n \n cat > fake-editor.sh << EOF\n #!/bin/sh\n-test \"\\$1\" = .git/COMMIT_EDITMSG && exit\n+test \"\\$1\" = .git/COMMIT_EDITMSG && {\n+\ttest -z \"\\$FAKE_COMMIT_MESSAGE\" || echo \"\\$FAKE_COMMIT_MESSAGE\" > \"\\$1\"\n+\texit\n+}\n test -z \"\\$FAKE_LINES\" && exit\n grep -v \"^#\" < \"\\$1\" > \"\\$1\".tmp\n rm \"\\$1\"\n@@ -181,6 +184,7 @@ test_expect_success 'preserve merges with -p' '\n \techo C > file1 &&\n \ttest_tick &&\n \tgit commit -m K file1 &&\n+\ttest_tick &&\n \tgit rebase -i -p --onto branch1 master &&\n \ttest $(git rev-parse HEAD^^2) = $(git rev-parse to-be-preserved) &&\n \ttest $(git rev-parse HEAD~3) = $(git rev-parse branch1) &&\n@@ -188,4 +192,14 @@ test_expect_success 'preserve merges with -p' '\n \ttest $(git show HEAD~2:file1) = B\n '\n \n+test_expect_success '--continue tries to commit' '\n+\ttest_tick &&\n+\t! git rebase -i --onto new-branch1 HEAD^ &&\n+\techo resolved > file1 &&\n+\tgit add file1 &&\n+\tFAKE_COMMIT_MESSAGE=\"chouette!\" git rebase --continue &&\n+\ttest $(git rev-parse HEAD^) = $(git rev-parse new-branch1) &&\n+\tgit show HEAD | grep chouette\n+'\n+\n test_done\n-- \n1.5.3.rc0.2712.g125b7f\n"},{"id":"46733","messageId":"Pine.LNX.4.64.0707080537490.4093@racer.site","threadId":"8924","inReplyTo":"Pine.LNX.4.64.0707080300440.4093@racer.site","subject":"Re: [PATCH 1/3] rebase -i: handle --continue more like non-interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-08T04:40:53Z","receivedAt":"2007-07-08T04:40:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 8 Jul 2007, Johannes Schindelin wrote:\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 0c2a969..67f2ee2 100755\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n>\n> [...]\n>\n> @@ -265,6 +264,14 @@ do\n>  \n>  \t\ttest -d \"$DOTEST\" || die \"No interactive rebase running\"\n>  \n> +\t\t# commit if necessary\n> +\t\tgit rev-parse --verify HEAD > /dev/null &&\n> +\t\tgit update-index --refresh &&\n> +\t\tgit diff-files --quiet &&\n> +\t\t! git diff-index --cached --quiet HEAD &&\n> +\t\t. \"$DOTEST\"/author-script &&\n> +\t\tgit commit -F \"$DOTEST\"/message -e\n> +\n\nOh well. For this to work, there has to be a line\n\n\t\texport GIT_AUTHOR_NAME GIT_AUTHOR_NAME GIT_AUTHOR_DATE &&\n\nbefore the \"git commit\" line, I think.\n\nCiao,\nDscho\n"},{"id":"47212","messageId":"20070712222640.GA30532@steel.home","threadId":"8924","inReplyTo":"Pine.LNX.4.64.0707080300440.4093@racer.site","subject":"Re: [PATCH 1/3] rebase -i: handle --continue more like non-interactive rebase","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-12T22:26:40Z","receivedAt":"2007-07-12T22:26:40Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Sun, Jul 08, 2007 04:01:29 +0200:\n> Non-interactive rebase requires the working tree to be clean, but\n> applies what is in the index without requiring the user to do it\n> herself.  Imitate that, but (since we are interactive, after all)\n> fire up an editor with the commit message.\n\nCould we also have \"git rebase <base> <branch>\"?\nI find it useful when I have many branches to rebase:\n\n    ~/project @master$ git rebase master branch1\n    ~/project @branch1$ git rebase master branch2\n    ~/project @branch2$ git rebase master branch3\n    ...\n\nOtherwise one have to, for example, \"git checkout branch1\" first,\nand only then run rebase-interactive. Checkout is not very pleasant\noperation on windows if you have many files (well, nothing is pleasant\nthere, but this one have to be done often). Rebase-interactive is\n*very* slow there, but I just could not part with it after having\ntried it once :)\n"},{"id":"49317","messageId":"Pine.LNX.4.64.0708011654510.14781@racer.site","threadId":"8924","inReplyTo":"20070712222640.GA30532@steel.home","subject":"Re: [PATCH 1/3] rebase -i: handle --continue more like non-interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-01T15:57:25Z","receivedAt":"2007-08-01T15:57:25Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 13 Jul 2007, Alex Riesen wrote:\n\n> Johannes Schindelin, Sun, Jul 08, 2007 04:01:29 +0200:\n> > Non-interactive rebase requires the working tree to be clean, but\n> > applies what is in the index without requiring the user to do it\n> > herself.  Imitate that, but (since we are interactive, after all)\n> > fire up an editor with the commit message.\n> \n> Could we also have \"git rebase <base> <branch>\"?\n\nDon't we do that already?  AFAICT it is already in the synopsis, ever \nsince rebase -i was introduced into the \"next\" branch, on June 25...\n\nCiao,\nDscho\n"},{"id":"49351","messageId":"20070801214556.GA2911@steel.home","threadId":"8924","inReplyTo":"Pine.LNX.4.64.0708011654510.14781@racer.site","subject":"Re: [PATCH 1/3] rebase -i: handle --continue more like non-interactive rebase","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-01T21:45:56Z","receivedAt":"2007-08-01T21:45:56Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Wed, Aug 01, 2007 17:57:25 +0200:\n> On Fri, 13 Jul 2007, Alex Riesen wrote:\n> > Johannes Schindelin, Sun, Jul 08, 2007 04:01:29 +0200:\n> > > Non-interactive rebase requires the working tree to be clean, but\n> > > applies what is in the index without requiring the user to do it\n> > > herself.  Imitate that, but (since we are interactive, after all)\n> > > fire up an editor with the commit message.\n> > \n> > Could we also have \"git rebase <base> <branch>\"?\n> \n> Don't we do that already?  AFAICT it is already in the synopsis, ever \n> since rebase -i was introduced into the \"next\" branch, on June 25...\n> \n\nErr... \"git rebase -i <base> <branch>\"\n\nDoes not work, just checked:\n\n    $ git rebase -i base branch\n    /usr/local/bin/git-rebase--interactive: 482: cannot create /home/user/projects/tmp/.git/.dotest-merge/output: Directory nonexistent\n    cat: /home/user/projects/tmp/.git/.dotest-merge/output: No such file or directory\n    Invalid branchname: branch\n"},{"id":"49361","messageId":"Pine.LNX.4.64.0708012329560.14781@racer.site","threadId":"8924","inReplyTo":"20070801214556.GA2911@steel.home","subject":"[PATCH] rebase -i: fix for optional [branch] parameter","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-01T22:31:03Z","receivedAt":"2007-08-01T22:31:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen calling \"git rebase -i <upstream> <branch>\", git should switch\nto <branch> first.  This worked before, but I broke it by my\n\"Shut git rebase -i up\" patch.\n\nFix that, and add a test to make sure that it does not break again.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Wed, 1 Aug 2007, Alex Riesen wrote:\n\n\t> Johannes Schindelin, Wed, Aug 01, 2007 17:57:25 +0200:\n\t> > On Fri, 13 Jul 2007, Alex Riesen wrote:\n\t> >\n\t> > > Could we also have \"git rebase <base> <branch>\"?\n\t> > \n\t> > Don't we do that already?  AFAICT it is already in the \n\t> > synopsis, ever since rebase -i was introduced into the \"next\" \n\t> > branch, on June 25...\n\t> > \n\t> \n\t> Err... \"git rebase -i <base> <branch>\"\n\t> \n\t> Does not work, just checked:\n\t> \n\t>     $ git rebase -i base branch\n\t>     /usr/local/bin/git-rebase--interactive: 482: cannot create /home/user/projects/tmp/.git/.dotest-merge/output: Directory nonexistent\n\t>     cat: /home/user/projects/tmp/.git/.dotest-merge/output: No such file or directory\n\t>     Invalid branchname: branch\n\n\tSorry...\n\n git-rebase--interactive.sh    |    2 +-\n t/t3404-rebase-interactive.sh |    8 ++++++++\n 2 files changed, 9 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex d3addd4..bdec462 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -405,6 +405,7 @@ do\n \n \t\trequire_clean_work_tree\n \n+\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n \t\tif test ! -z \"$2\"\n \t\tthen\n \t\t\toutput git show-ref --verify --quiet \"refs/heads/$2\" ||\n@@ -418,7 +419,6 @@ do\n \n \t\ttest -z \"$ONTO\" && ONTO=$UPSTREAM\n \n-\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n \t\t: > \"$DOTEST\"/interactive || die \"Could not mark as interactive\"\n \t\tgit symbolic-ref HEAD > \"$DOTEST\"/head-name ||\n \t\t\tdie \"Could not get HEAD\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex dc436d7..a9b552f 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -98,6 +98,14 @@ test_expect_success 'no changes are a nop' '\n \ttest $(git rev-parse I) = $(git rev-parse HEAD)\n '\n \n+test_expect_success 'test the [branch] option' '\n+\tgit checkout -b dead-end &&\n+\tgit rm file6 &&\n+\tgit commit -m \"stop here\" &&\n+\tgit rebase -i F branch2 &&\n+\ttest $(git rev-parse I) = $(git rev-parse HEAD)\n+'\n+\n test_expect_success 'rebase on top of a non-conflicting commit' '\n \tgit checkout branch1 &&\n \tgit tag original-branch1 &&\n-- \n1.5.3.rc3.112.gf60b6\n"},{"id":"49362","messageId":"20070801223241.GB2911@steel.home","threadId":"8924","inReplyTo":"20070801214556.GA2911@steel.home","subject":"[PATCH] Fix rebase interactive to allow specifying branch to rebase along with the base","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-01T22:32:41Z","receivedAt":"2007-08-01T22:32:41Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Signed-off-by: Alex Riesen <raa.lkml@gmail.com>\n---\n git-rebase--interactive.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\nAlex Riesen, Wed, Aug 01, 2007 23:45:56 +0200:\n>     $ git rebase -i base branch\n>     /usr/local/bin/git-rebase--interactive: 482: cannot create /home/user/projects/tmp/.git/.dotest-merge/output: Directory nonexistent\n>     cat: /home/user/projects/tmp/.git/.dotest-merge/output: No such file or directory\n>     Invalid branchname: branch\n\nOh... Sometimes I can *very* slow. I believe it is as simple as that\n\n git-rebase--interactive.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 061cd0a..b42dee8 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -404,6 +404,7 @@ do\n \t\tesac\n \n \t\trequire_clean_work_tree\n+\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n \n \t\tif test ! -z \"$2\"\n \t\tthen\n@@ -418,7 +419,6 @@ do\n \n \t\ttest -z \"$ONTO\" && ONTO=$UPSTREAM\n \n-\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n \t\t: > \"$DOTEST\"/interactive || die \"Could not mark as interactive\"\n \t\tgit symbolic-ref HEAD > \"$DOTEST\"/head-name ||\n \t\t\tdie \"Could not get HEAD\"\n-- \n1.5.3.rc3.123.ge9877\n"},{"id":"49364","messageId":"Pine.LNX.4.64.0708012336170.14781@racer.site","threadId":"8924","inReplyTo":"20070801223241.GB2911@steel.home","subject":"Re: [PATCH] Fix rebase interactive to allow specifying branch to rebase along with the base","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-01T22:36:58Z","receivedAt":"2007-08-01T22:36:58Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 2 Aug 2007, Alex Riesen wrote:\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 061cd0a..b42dee8 100755\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -404,6 +404,7 @@ do\n>  \t\tesac\n>  \n>  \t\trequire_clean_work_tree\n> +\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n>  \n>  \t\tif test ! -z \"$2\"\n>  \t\tthen\n> @@ -418,7 +419,6 @@ do\n>  \n>  \t\ttest -z \"$ONTO\" && ONTO=$UPSTREAM\n>  \n> -\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n>  \t\t: > \"$DOTEST\"/interactive || die \"Could not mark as interactive\"\n>  \t\tgit symbolic-ref HEAD > \"$DOTEST\"/head-name ||\n>  \t\t\tdie \"Could not get HEAD\"\n\nHeh.  I take that as an ACK from you to my patch?  Mine has a test case, \ntoo ;-)\n\nCiao,\nDscho\n"},{"id":"49366","messageId":"20070801224014.GD2911@steel.home","threadId":"8924","inReplyTo":"Pine.LNX.4.64.0708012336170.14781@racer.site","subject":"Re: [PATCH] Fix rebase interactive to allow specifying branch to rebase along with the base","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-01T22:40:14Z","receivedAt":"2007-08-01T22:40:14Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Thu, Aug 02, 2007 00:36:58 +0200:\n> On Thu, 2 Aug 2007, Alex Riesen wrote:\n> >  \t\trequire_clean_work_tree\n> > +\t\tmkdir \"$DOTEST\" || die \"Could not create temporary $DOTEST\"\n> \n> Heh.  I take that as an ACK from you to my patch?  Mine has a test case, \n> too ;-)\n\nACK, indeed 8)\n"}]}