{"thread":{"id":"31490","subject":"[RFC] Add \"edit\" action for interactive rebase?","startedAt":"2012-09-10T16:14:42Z","lastAt":"2012-09-19T19:52:28Z","messageCount":34,"participants":["Andrew Wong","Matthieu Moy","Jeff King","Johannes Sixt","Junio C Hamano","Martin von Zweigbergk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"198681","messageId":"1347293683-27996-1-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":null,"subject":"[RFC] Add \"edit\" action for interactive rebase?","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-10T16:14:42Z","receivedAt":"2012-09-10T16:14:42Z","isPatch":false,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Occasionally, while I'm in the middle of an interactive rebase, I'd change my\nmind about the todo list and want to modify it.  This means manually digging\nout the todo file from the rebase directory, and invoking the editor.  So I\nthought it might be convenient to have an \"edit\" action that simply invokes the\neditor on the todo file but do nothing else.\n\nThis should be safe to do in the middle of a rebase, since we don't preprocess\nthe todo file and generate any state from it.  I've also been manually editing\nthe todo file a while now, and I never ran into any issues.\n\nI wonder if any others have ever ran into this situation, and would this be\na useful feature to have in interactive rebase? Comments?\n\nThis patch doesn't have any documentations yet. I'll add some documentations in\nanother patch if we decide to include this.\n\nAndrew Wong (1):\n  rebase -i: Teach \"--edit\" action\n\n git-rebase--interactive.sh |  6 ++++++\n git-rebase.sh              | 14 ++++++++++++++\n 2 files changed, 20 insertions(+)\n\n-- \n1.7.12.289.g0ce9864.dirty\n"},{"id":"198682","messageId":"1347293683-27996-2-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347293683-27996-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH] rebase -i: Teach \"--edit\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-10T16:14:43Z","receivedAt":"2012-09-10T16:14:43Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"This allows users to edit the todo list while they're in the middle of\nan interactive rebase.\n\nSigned-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n git-rebase--interactive.sh |  6 ++++++\n git-rebase.sh              | 14 ++++++++++++++\n 2 files changed, 20 insertions(+)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex a09e842..e9dbcf3 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -775,6 +775,12 @@ skip)\n \n \tdo_rest\n \t;;\n+edit)\n+  git_sequence_editor \"$todo\" ||\n+    die_abort \"Could not execute editor\"\n+\n+  exit\n+  ;;\n esac\n \n git var GIT_COMMITTER_IDENT >/dev/null ||\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 15da926..c394b8d 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -38,6 +38,7 @@ C=!                passed to 'git apply'\n continue!          continue\n abort!             abort and check out the original branch\n skip!              skip current patch and continue\n+edit!              edit the todo list during interactive rebase\n \"\n . git-sh-setup\n . git-sh-i18n\n@@ -194,6 +195,10 @@ do\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n+\t--edit)\n+\t\ttest $total_argc -eq 2 || usage\n+\t\taction=${1##--}\n+\t\t;;\n \t--onto)\n \t\ttest 2 -le \"$#\" || usage\n \t\tonto=\"$2\"\n@@ -306,6 +311,12 @@ then\n \tfi\n fi\n \n+if test \"$action\" = \"edit\" &&\n+  test \"$type\" != \"interactive\"\n+then\n+  die \"$(gettext \"The --edit action can only be used during interactive rebase.\")\"\n+fi\n+\n case \"$action\" in\n continue)\n \t# Sanity check\n@@ -338,6 +349,9 @@ abort)\n \trm -r \"$state_dir\"\n \texit\n \t;;\n+edit)\n+\trun_specific_rebase\n+  ;;\n esac\n \n # Make sure no rebase is in progress\n-- \n1.7.12.289.g0ce9864.dirty\n"},{"id":"198687","messageId":"vpqk3w1j15v.fsf@bauges.imag.fr","threadId":"31490","inReplyTo":"1347293683-27996-2-git-send-email-andrew.kw.w@gmail.com","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-09-10T16:25:00Z","receivedAt":"2012-09-10T16:25:00Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Andrew Wong <andrew.kw.w@gmail.com> writes:\n\n> This allows users to edit the todo list while they're in the middle of\n> an interactive rebase.\n\nI like the idea.\n\n> +edit)\n> +  git_sequence_editor \"$todo\" ||\n> +    die_abort \"Could not execute editor\"\n> +\n> +  exit\n> +  ;;\n\nIndent with space. Please, use tabs (same below).\n\n> index 15da926..c394b8d 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -38,6 +38,7 @@ C=!                passed to 'git apply'\n>  continue!          continue\n>  abort!             abort and check out the original branch\n>  skip!              skip current patch and continue\n> +edit!              edit the todo list during interactive rebase\n\nJust \"edit\" may be a bit misleading, as we already have the \"edit\"\naction inside the todolist. I'd call this --edit-list to avoid\nambiguity.\n\nThis lacks tests, IMHO, as there are many corner-cases (e.g. should we\nbe allowed to --edit-list while the worktree is in conflict?) that would\ndeserve to be at least discussed, and as much as possible automatically\ntested.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"198694","messageId":"CADgNja=z7EDTV8_2CU9Uc7w=Dmtp90GrPkDUFSPbucfyrEsBaQ@mail.gmail.com","threadId":"31490","inReplyTo":"vpqk3w1j15v.fsf@bauges.imag.fr","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-10T16:46:45Z","receivedAt":"2012-09-10T16:46:45Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"On Mon, Sep 10, 2012 at 12:25 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Indent with space. Please, use tabs (same below).\n\nAh, thanks. Good catch.\n\n> Just \"edit\" may be a bit misleading, as we already have the \"edit\"\n> action inside the todolist. I'd call this --edit-list to avoid\n> ambiguity.\n\nI thought that might be a bit confusing too. \"--edit-list\" doesn't\nseem informative about what \"list\" we're editing though. What about\n\"--edit-todo\"? Any suggestions are welcomed.\n\n> This lacks tests, IMHO, as there are many corner-cases (e.g. should we\n> be allowed to --edit-list while the worktree is in conflict?) that would\n> deserve to be at least discussed, and as much as possible automatically\n> tested.\n\nIt does seem risky to do, since we're exposing something that used to\nbe internal to \"rebase -i\". Though I don't see harm in allowing\nmodifications even when there's a conflict, since we're not really\ncommitting anything, modifying index, or any worktree file. As long as\nthe todo file exists, and we're stopped in the middle of a rebase, I\nthink editing it shouldn't cause any problems.\n"},{"id":"198695","messageId":"20120910165457.GB14201@sigill.intra.peff.net","threadId":"31490","inReplyTo":"CADgNja=z7EDTV8_2CU9Uc7w=Dmtp90GrPkDUFSPbucfyrEsBaQ@mail.gmail.com","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-09-10T16:54:57Z","receivedAt":"2012-09-10T16:54:57Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 10, 2012 at 12:46:45PM -0400, Andrew Wong wrote:\n\n> > Just \"edit\" may be a bit misleading, as we already have the \"edit\"\n> > action inside the todolist. I'd call this --edit-list to avoid\n> > ambiguity.\n> \n> I thought that might be a bit confusing too. \"--edit-list\" doesn't\n> seem informative about what \"list\" we're editing though. What about\n> \"--edit-todo\"? Any suggestions are welcomed.\n\nDoes it ever make sense to edit and then _not_ immediately continue?\nYou can't affect the current commit anyway (it has already been pulled\nfrom the todo list), so the next thing you'd want to do it actually act\non whatever you put into the todo list[1].\n\nWhat if it was called --continue-with-edit or something, and then:\n\n> > This lacks tests, IMHO, as there are many corner-cases (e.g. should we\n> > be allowed to --edit-list while the worktree is in conflict?) that would\n> > deserve to be at least discussed, and as much as possible automatically\n> > tested.\n\nWe would not even allow the edit if we were not OK to continue.\n\n-Peff\n\n[1] It does preclude using \"--edit\" to make a note about a later commit\n    while you are in the middle of resolving a conflict or something.\n    You'd have to do it at the end. I don't know if anybody actually\n    cares about that.\n"},{"id":"198707","messageId":"504E3145.9070006@kdbg.org","threadId":"31490","inReplyTo":"1347293683-27996-1-git-send-email-andrew.kw.w@gmail.com","subject":"Re: [RFC] Add \"edit\" action for interactive rebase?","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-09-10T18:28:21Z","receivedAt":"2012-09-10T18:28:21Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.09.2012 18:14, schrieb Andrew Wong:\n> Occasionally, while I'm in the middle of an interactive rebase, I'd change my\n> mind about the todo list and want to modify it.  This means manually digging\n> out the todo file from the rebase directory, and invoking the editor.  So I\n> thought it might be convenient to have an \"edit\" action that simply invokes the\n> editor on the todo file but do nothing else.\n> \n> This should be safe to do in the middle of a rebase, since we don't preprocess\n> the todo file and generate any state from it.  I've also been manually editing\n> the todo file a while now, and I never ran into any issues.\n> \n> I wonder if any others have ever ran into this situation, and would this be\n> a useful feature to have in interactive rebase? Comments?\n\nApplause! A very welcome addition. I've found myself editing the todo\nlist every now and then, and I'd like to do that more often. This new\nfeature would make it dead simple.\n\nDid you think about what can go wrong? For example, starting with this\ntodo sheet:\n\n  exec false\n  pick 1234567\n\nand then the user changes the 'pick' to 'squash' after rebase stopped at\nthe failed 'exec' command.\n\n-- Hannes\n"},{"id":"198708","messageId":"504E333B.2010602@kdbg.org","threadId":"31490","inReplyTo":"20120910165457.GB14201@sigill.intra.peff.net","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-09-10T18:36:43Z","receivedAt":"2012-09-10T18:36:43Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.09.2012 18:54, schrieb Jeff King:\n> On Mon, Sep 10, 2012 at 12:46:45PM -0400, Andrew Wong wrote:\n> \n>>> Just \"edit\" may be a bit misleading, as we already have the \"edit\"\n>>> action inside the todolist. I'd call this --edit-list to avoid\n>>> ambiguity.\n>>\n>> I thought that might be a bit confusing too. \"--edit-list\" doesn't\n>> seem informative about what \"list\" we're editing though. What about\n>> \"--edit-todo\"? Any suggestions are welcomed.\n> \n> Does it ever make sense to edit and then _not_ immediately continue?\n\nYes. For example, while you are resolving a conflict, you might notice\nthat it would make sense to do something different in the remaining\nrebase sequence. You don't want to continue if some conflicts remain.\nAnd you don't want to wait editing the todo list until you are done with\nthe conflicts because you might have forgotten that you wanted to do\nsomething different.\n\n> You can't affect the current commit anyway (it has already been pulled\n> from the todo list), so the next thing you'd want to do it actually act\n> on whatever you put into the todo list[1].\n\nOh, you said it here:\n\n> [1] It does preclude using \"--edit\" to make a note about a later commit\n>     while you are in the middle of resolving a conflict or something.\n>     You'd have to do it at the end. I don't know if anybody actually\n>     cares about that.\n\nYes, I do care. At times I tend to have a very short attention span. Or\nit is Windows's slowness that expires my short-term memory more often\nthan not. ;)\n\n-- Hannes\n"},{"id":"198709","messageId":"20120910184625.GA32237@sigill.intra.peff.net","threadId":"31490","inReplyTo":"504E333B.2010602@kdbg.org","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-09-10T18:46:25Z","receivedAt":"2012-09-10T18:46:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 10, 2012 at 08:36:43PM +0200, Johannes Sixt wrote:\n\n> > [1] It does preclude using \"--edit\" to make a note about a later commit\n> >     while you are in the middle of resolving a conflict or something.\n> >     You'd have to do it at the end. I don't know if anybody actually\n> >     cares about that.\n> \n> Yes, I do care. At times I tend to have a very short attention span. Or\n> it is Windows's slowness that expires my short-term memory more often\n> than not. ;)\n\nOK, then I withdraw my proposal. :)\n\nIt sounds like it would be safe to do:\n\n  git rebase --edit-todo\n  hack hack hack\n  git rebase --continue\n\nanyway, so the restriction is not as valuable as it would otherwise have\nbeen.\n\n-Peff\n"},{"id":"198711","messageId":"CADgNjamB9wG_Vbt1Zwu8Tmt3vQ8XpYys6ngjQeQb2DgnqKeHJg@mail.gmail.com","threadId":"31490","inReplyTo":"20120910184625.GA32237@sigill.intra.peff.net","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-10T19:33:19Z","receivedAt":"2012-09-10T19:33:19Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"On Mon, Sep 10, 2012 at 2:46 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Sep 10, 2012 at 08:36:43PM +0200, Johannes Sixt wrote:\n>\n>> > [1] It does preclude using \"--edit\" to make a note about a later commit\n>> >     while you are in the middle of resolving a conflict or something.\n>> >     You'd have to do it at the end. I don't know if anybody actually\n>> >     cares about that.\n>>\n>> Yes, I do care. At times I tend to have a very short attention span. Or\n>> it is Windows's slowness that expires my short-term memory more often\n>> than not. ;)\n>\n> OK, then I withdraw my proposal. :)\n>\n> It sounds like it would be safe to do:\n>\n>   git rebase --edit-todo\n>   hack hack hack\n>   git rebase --continue\n\nJohannes took the words right out of my mouth.  Also, \"edit and _not_\ncontinue\" also gives the user a chance to second guess while editing\nthe todo.\n\nThat got me thinking... Currently, the todo list has this line at the bottome:\n    # However, if you remove everything, the rebase will be aborted.\n\nWe'd probably want to remove that line, since \"remove everything\" no\nlonger aborts the rebase. It'll just finish the rebase.  It'll be ugly\nto sed it out.  Maybe one way to do this is to remove all the comments\nand append new ones.\n\nIt might also be nice to add a note to remind the user that they're\nediting a todo file in a stopped rebase state. i.e. not a fresh\ninteractive rebase\n"},{"id":"198715","messageId":"7vd31todkq.fsf@alter.siamese.dyndns.org","threadId":"31490","inReplyTo":"CADgNjamB9wG_Vbt1Zwu8Tmt3vQ8XpYys6ngjQeQb2DgnqKeHJg@mail.gmail.com","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-10T19:57:57Z","receivedAt":"2012-09-10T19:57:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Wong <andrew.kw.w@gmail.com> writes:\n\n> On Mon, Sep 10, 2012 at 2:46 PM, Jeff King <peff@peff.net> wrote:\n>> On Mon, Sep 10, 2012 at 08:36:43PM +0200, Johannes Sixt wrote:\n>>\n>>> > [1] It does preclude using \"--edit\" to make a note about a later commit\n>>> >     while you are in the middle of resolving a conflict or something.\n>>> >     You'd have to do it at the end. I don't know if anybody actually\n>>> >     cares about that.\n>>>\n>>> Yes, I do care. At times I tend to have a very short attention span. Or\n>>> it is Windows's slowness that expires my short-term memory more often\n>>> than not. ;)\n>>\n>> OK, then I withdraw my proposal. :)\n>>\n>> It sounds like it would be safe to do:\n>>\n>>   git rebase --edit-todo\n>>   hack hack hack\n>>   git rebase --continue\n>\n> Johannes took the words right out of my mouth.  Also, \"edit and _not_\n> continue\" also gives the user a chance to second guess while editing\n> the todo.\n\ndo you mean \"double check\"?\n\n> That got me thinking... Currently, the todo list has this line at the bottome:\n>     # However, if you remove everything, the rebase will be aborted.\n>\n> We'd probably want to remove that line, since \"remove everything\" no\n> longer aborts the rebase. It'll just finish the rebase.\n\nGood precaution.\n\n> It might also be nice to add a note to remind the user that they're\n> editing a todo file in a stopped rebase state. i.e. not a fresh\n> interactive rebase\n\nHrm...  They see the contents of the todo file immediately after\nthey say \"rebase --edit-todo\" and the sole reason they said that\ncommand is because they wanted to edit the todo file.  Is it likely\nthey need a reminder?\n"},{"id":"198720","messageId":"CADgNjakmRsfqBajpeob0e2pA9tSj5KSS+0m6rkR+9bdBV+ZepA@mail.gmail.com","threadId":"31490","inReplyTo":"504E3145.9070006@kdbg.org","subject":"Re: [RFC] Add \"edit\" action for interactive rebase?","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-10T20:13:01Z","receivedAt":"2012-09-10T20:13:01Z","isPatch":false,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"On Mon, Sep 10, 2012 at 2:28 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n> Did you think about what can go wrong? For example, starting with this\n> todo sheet:\n>\n>   exec false\n>   pick 1234567\n\nAh, that's definitely a problem.\n\nI was going to say we probably just to check the \"done\" file, same as\nthe one we do for a fresh \"rebase -i\", but it turns out the \"exec\nfalse\" will fool the \"has_action\" check for a fresh \"rebase -i\" too.\nHeh.\n\nMaybe we should improve the check for a fresh \"rebase -i\" case, then\nwe can do the same check for this case. Maybe we can grep for a \"pick\"\nin \"done\" file? Or we can check if there's anything in \"rewritten\"?\nThough I'm not sure if any of those is really foolproof. Or should we\njust ignore this case and assume the user knows what s/he's doing?\n\nIncidentally, if the starting todo file is:\n    pick A\n    exec false\n    pick B\n\nIf the user then changes the \"pick B\" to \"squash B\", it should be a\nvalid I think, and \"rebase -i\" should handle that properly. It should,\nbecause that's the same thing as:\n    pick C (which results in a conflict and stopped)\n    squash D\n\nOT: That \"exec false\" !\nI ran into numerous occasions where I wanted to manually do something\nbefore the \"first commit after upstream\", such as creating a new\ncommit or merge.  And I only had two ways of doing it:\n1. to rebase against \"upstream^\", and then mark the upstream as edit\n2. insert a \"exec bash\" in front of the \"first commit\"\nBut \"exec false\" will work much much nicer. :)\n"},{"id":"198729","messageId":"CADgNjambUXj+WEFg=OWvtDQ1EKFhavwbjMbTVaP69rhh5DrphA@mail.gmail.com","threadId":"31490","inReplyTo":"7vd31todkq.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] rebase -i: Teach \"--edit\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-10T21:17:45Z","receivedAt":"2012-09-10T21:17:45Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"On Mon, Sep 10, 2012 at 3:57 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Hrm...  They see the contents of the todo file immediately after\n> they say \"rebase --edit-todo\" and the sole reason they said that\n> command is because they wanted to edit the todo file.  Is it likely\n> they need a reminder?\n\nYes, it's not very likely, but sometimes the todo file takes a bit of\ntime to finalize.  So there's a good chance that the user can get\ninterrupted, context switched, or went to do some double checking. And\nwhen the user returns to the editor, it's difficult to tell whether\nhe's in a fresh rebase or a stopped rebase, unless he remembers.  It's\nan unlikely scenario, but if it does happen, I think a short reminder\ncould avoid some user panic.\n\nI don't plan to change how the todo file looks for a fresh rebase.\nI'll probably just add something like this for the stopped rebase\ncase:\n     # You are editing the todo of an ongoing rebase. To continue\nrebase after editing, run: \"git rebase --continue\"\n\nThat will also remind the user to run \"--continue\" afterwards.\n"},{"id":"199113","messageId":"1347739709-15289-1-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"CADgNjambUXj+WEFg=OWvtDQ1EKFhavwbjMbTVaP69rhh5DrphA@mail.gmail.com","subject":"[PATCH 0/3] rebase -i: Teach \"--edit-todo\"","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-15T20:08:26Z","receivedAt":"2012-09-15T20:08:26Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"The flag will allow the user to edit the todo file while they're in the middle\nof an interactive rebase. It simply invoke the editor and do nothing else.\n\nMore discussions here:\n    http://thread.gmane.org/gmane.comp.version-control.git/205133/focus=205182\n\nAndrew Wong (3):\n  rebase -i: Refactor help messages for todo file\n  rebase -i: Teach \"--edit-todo\" action\n  rebase -i: Add tests for \"--edit-todo\"\n\n Documentation/git-rebase.txt  |  5 ++++-\n git-rebase--interactive.sh    | 47 +++++++++++++++++++++++++++++++++----------\n git-rebase.sh                 | 14 +++++++++++++\n t/t3404-rebase-interactive.sh | 16 +++++++++++++++\n 4 files changed, 70 insertions(+), 12 deletions(-)\n\n-- \n1.7.12.318.g08bf5ad.dirty\n"},{"id":"199112","messageId":"1347739709-15289-2-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347739709-15289-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 1/3] rebase -i: Refactor help messages for todo file","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-15T20:08:27Z","receivedAt":"2012-09-15T20:08:27Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n git-rebase--interactive.sh | 31 ++++++++++++++++++++-----------\n 1 file changed, 20 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex a09e842..4d57e50 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -115,6 +115,23 @@ mark_action_done () {\n \tfi\n }\n \n+append_todo_help () {\n+\tcat >> \"$todo\" << EOF\n+#\n+# Commands:\n+#  p, pick = use commit\n+#  r, reword = use commit, but edit the commit message\n+#  e, edit = use commit, but stop for amending\n+#  s, squash = use commit, but meld into previous commit\n+#  f, fixup = like \"squash\", but discard this commit's log message\n+#  x, exec = run command (the rest of the line) using shell\n+#\n+# These lines can be re-ordered; they are executed from top to bottom.\n+#\n+# If you remove a line here THAT COMMIT WILL BE LOST.\n+EOF\n+}\n+\n make_patch () {\n \tsha1_and_parents=\"$(git rev-list --parents -1 \"$1\")\"\n \tcase \"$sha1_and_parents\" in\n@@ -901,18 +918,10 @@ test -n \"$cmd\" && add_exec_commands \"$todo\"\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\n+EOF\n+append_todo_help\n+cat >> \"$todo\" << EOF\n #\n-# Commands:\n-#  p, pick = use commit\n-#  r, reword = use commit, but edit the commit message\n-#  e, edit = use commit, but stop for amending\n-#  s, squash = use commit, but meld into previous commit\n-#  f, fixup = like \"squash\", but discard this commit's log message\n-#  x, exec = run command (the rest of the line) using shell\n-#\n-# These lines can be re-ordered; they are executed from top to bottom.\n-#\n-# If you remove a line here THAT COMMIT WILL BE LOST.\n # However, if you remove everything, the rebase will be aborted.\n #\n EOF\n-- \n1.7.12.318.g08bf5ad.dirty\n"},{"id":"199114","messageId":"1347739709-15289-3-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347739709-15289-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 2/3] rebase -i: Teach \"--edit-todo\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-15T20:08:28Z","receivedAt":"2012-09-15T20:08:28Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"This allows users to edit the todo file while they're stopped in the\nmiddle of an interactive rebase. When this action is executed, all\ncomments from the original todo file are stripped, and new help messages\nare appended to the end.\n\nSigned-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n Documentation/git-rebase.txt |  5 ++++-\n git-rebase--interactive.sh   | 16 ++++++++++++++++\n git-rebase.sh                | 14 ++++++++++++++\n 3 files changed, 34 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex fd535b0..da067ec 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n \t[<upstream>] [<branch>]\n 'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t--root [<branch>]\n-'git rebase' --continue | --skip | --abort\n+'git rebase' --continue | --skip | --abort | --edit-todo\n \n DESCRIPTION\n -----------\n@@ -245,6 +245,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.\n --skip::\n \tRestart the rebasing process by skipping the current patch.\n \n+--edit-todo::\n+\tEdit the todo list during an interactive rebase.\n+\n -m::\n --merge::\n \tUse merging strategies to rebase.  When the recursive (default) merge\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 4d57e50..ca55fac 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -792,6 +792,22 @@ skip)\n \n \tdo_rest\n \t;;\n+edit-todo)\n+\tsed -i '/^#/d' \"$todo\"\n+\tappend_todo_help\n+\tcat >> \"$todo\" << EOF\n+#\n+# You are editing the todo file of an ongoing interactive rebase.\n+# To continue rebase after editing, run:\n+#     git rebase --continue\n+#\n+EOF\n+\n+\tgit_sequence_editor \"$todo\" ||\n+\tdie_abort \"Could not execute editor\"\n+\n+\texit\n+\t;;\n esac\n \n git var GIT_COMMITTER_IDENT >/dev/null ||\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 15da926..e660203 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -38,6 +38,7 @@ C=!                passed to 'git apply'\n continue!          continue\n abort!             abort and check out the original branch\n skip!              skip current patch and continue\n+edit-todo!         edit the todo list during an interactive rebase\n \"\n . git-sh-setup\n . git-sh-i18n\n@@ -194,6 +195,10 @@ do\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n+\t--edit-todo)\n+\t\ttest $total_argc -eq 2 || usage\n+\t\taction=${1##--}\n+\t\t;;\n \t--onto)\n \t\ttest 2 -le \"$#\" || usage\n \t\tonto=\"$2\"\n@@ -306,6 +311,12 @@ then\n \tfi\n fi\n \n+if test \"$action\" = \"edit-todo\" &&\n+\ttest \"$type\" != \"interactive\"\n+then\n+\tdie \"$(gettext \"The --edit-todo action can only be used during interactive rebase.\")\"\n+fi\n+\n case \"$action\" in\n continue)\n \t# Sanity check\n@@ -338,6 +349,9 @@ abort)\n \trm -r \"$state_dir\"\n \texit\n \t;;\n+edit-todo)\n+\trun_specific_rebase\n+\t;;\n esac\n \n # Make sure no rebase is in progress\n-- \n1.7.12.318.g08bf5ad.dirty\n"},{"id":"199115","messageId":"1347739709-15289-4-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347739709-15289-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 3/3] rebase -i: Add tests for \"--edit-todo\"","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-15T20:08:29Z","receivedAt":"2012-09-15T20:08:29Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n t/t3404-rebase-interactive.sh | 16 ++++++++++++++++\n 1 file changed, 16 insertions(+)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 7304b66..a194c97 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -911,4 +911,20 @@ test_expect_success 'rebase -i --root fixup root commit' '\n \ttest 0 = $(git cat-file commit HEAD | grep -c ^parent\\ )\n '\n \n+test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '\n+\tgit checkout conflict-branch &&\n+\ttest_must_fail git rebase --onto HEAD~2 HEAD~ &&\n+\ttest_must_fail git rebase --edit-todo &&\n+\tgit rebase --abort\n+'\n+\n+test_expect_success 'rebase --edit-todo can be used to modify todo' '\n+\tgit checkout no-conflict-branch^0 &&\n+\tFAKE_LINES=\"edit 1 2 3\" git rebase -i HEAD~3 &&\n+\tFAKE_LINES=\"2 1\" git rebase --edit-todo &&\n+\tgit rebase --continue\n+\ttest M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n+\ttest L = $(git cat-file commit HEAD | sed -ne \\$p)\n+'\n+\n test_done\n-- \n1.7.12.318.g08bf5ad.dirty\n"},{"id":"199137","messageId":"7v1ui2zccc.fsf@alter.siamese.dyndns.org","threadId":"31490","inReplyTo":"1347739709-15289-3-git-send-email-andrew.kw.w@gmail.com","subject":"Re: [PATCH 2/3] rebase -i: Teach \"--edit-todo\" action","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-16T06:54:59Z","receivedAt":"2012-09-16T06:54:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Wong <andrew.kw.w@gmail.com> writes:\n\n> This allows users to edit the todo file while they're stopped in the\n> middle of an interactive rebase. When this action is executed, all\n> comments from the original todo file are stripped, and new help messages\n> are appended to the end.\n>\n> Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n> ---\n>  Documentation/git-rebase.txt |  5 ++++-\n>  git-rebase--interactive.sh   | 16 ++++++++++++++++\n>  git-rebase.sh                | 14 ++++++++++++++\n>  3 files changed, 34 insertions(+), 1 deletion(-)\n>\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index fd535b0..da067ec 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -12,7 +12,7 @@ SYNOPSIS\n>  \t[<upstream>] [<branch>]\n>  'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n>  \t--root [<branch>]\n> -'git rebase' --continue | --skip | --abort\n> +'git rebase' --continue | --skip | --abort | --edit-todo\n>  \n>  DESCRIPTION\n>  -----------\n> @@ -245,6 +245,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.\n>  --skip::\n>  \tRestart the rebasing process by skipping the current patch.\n>  \n> +--edit-todo::\n> +\tEdit the todo list during an interactive rebase.\n> +\n>  -m::\n>  --merge::\n>  \tUse merging strategies to rebase.  When the recursive (default) merge\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 4d57e50..ca55fac 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -792,6 +792,22 @@ skip)\n>  \n>  \tdo_rest\n>  \t;;\n> +edit-todo)\n> +\tsed -i '/^#/d' \"$todo\"\n> +\tappend_todo_help\n\nI do not think the \"sed -i\" in-place edit is portable.  AFAIK, it is\nnot even in POSIX.1\n\nIn any case, what information are you discarding and then replacing\nwith the standard boilerplate?\n\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 15da926..e660203 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -38,6 +38,7 @@ C=!                passed to 'git apply'\n>  continue!          continue\n>  abort!             abort and check out the original branch\n>  skip!              skip current patch and continue\n> +edit-todo!         edit the todo list during an interactive rebase\n>  \"\n>  . git-sh-setup\n>  . git-sh-i18n\n> @@ -194,6 +195,10 @@ do\n>  \t\ttest $total_argc -eq 2 || usage\n>  \t\taction=${1##--}\n>  \t\t;;\n> +\t--edit-todo)\n> +\t\ttest $total_argc -eq 2 || usage\n> +\t\taction=${1##--}\n> +\t\t;;\n>  \t--onto)\n>  \t\ttest 2 -le \"$#\" || usage\n>  \t\tonto=\"$2\"\n> @@ -306,6 +311,12 @@ then\n>  \tfi\n>  fi\n>  \n> +if test \"$action\" = \"edit-todo\" &&\n> +\ttest \"$type\" != \"interactive\"\n\nI do not see a need to split this short expression into two lines.\n"},{"id":"199138","messageId":"7vwqzuxxmp.fsf@alter.siamese.dyndns.org","threadId":"31490","inReplyTo":"1347739709-15289-4-git-send-email-andrew.kw.w@gmail.com","subject":"Re: [PATCH 3/3] rebase -i: Add tests for \"--edit-todo\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-16T06:58:06Z","receivedAt":"2012-09-16T06:58:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Wong <andrew.kw.w@gmail.com> writes:\n\n> Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n> ---\n>  t/t3404-rebase-interactive.sh | 16 ++++++++++++++++\n>  1 file changed, 16 insertions(+)\n>\n> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\n> index 7304b66..a194c97 100755\n> --- a/t/t3404-rebase-interactive.sh\n> +++ b/t/t3404-rebase-interactive.sh\n> @@ -911,4 +911,20 @@ test_expect_success 'rebase -i --root fixup root commit' '\n>  \ttest 0 = $(git cat-file commit HEAD | grep -c ^parent\\ )\n>  '\n>  \n> +test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '\n> +\tgit checkout conflict-branch &&\n> +\ttest_must_fail git rebase --onto HEAD~2 HEAD~ &&\n> +\ttest_must_fail git rebase --edit-todo &&\n> +\tgit rebase --abort\n> +'\n\nIt _might_ be that you simply inherited sloppiness from surrounding\nexisting tests, but what happens when a test _before_ this test\nfailed?  Is \"git checkout conflict-branch\" sufficient to bring you\nto a sensible state where this test would succeed?  I'd prefer to\nsee a defensive \"git reset --hard &&\" before the first \"checkout\".\n\nThe same for the next one.\n\n> +test_expect_success 'rebase --edit-todo can be used to modify todo' '\n> +\tgit checkout no-conflict-branch^0 &&\n> +\tFAKE_LINES=\"edit 1 2 3\" git rebase -i HEAD~3 &&\n> +\tFAKE_LINES=\"2 1\" git rebase --edit-todo &&\n> +\tgit rebase --continue\n> +\ttest M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n> +\ttest L = $(git cat-file commit HEAD | sed -ne \\$p)\n> +'\n> +\n>  test_done\n"},{"id":"199167","messageId":"1347808623-1058-1-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"7vwqzuxxmp.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 1/3] rebase -i: Refactor help messages for todo file","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-16T15:17:01Z","receivedAt":"2012-09-16T15:17:01Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n git-rebase--interactive.sh | 31 ++++++++++++++++++++-----------\n 1 file changed, 20 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex a09e842..4d57e50 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -115,6 +115,23 @@ mark_action_done () {\n \tfi\n }\n \n+append_todo_help () {\n+\tcat >> \"$todo\" << EOF\n+#\n+# Commands:\n+#  p, pick = use commit\n+#  r, reword = use commit, but edit the commit message\n+#  e, edit = use commit, but stop for amending\n+#  s, squash = use commit, but meld into previous commit\n+#  f, fixup = like \"squash\", but discard this commit's log message\n+#  x, exec = run command (the rest of the line) using shell\n+#\n+# These lines can be re-ordered; they are executed from top to bottom.\n+#\n+# If you remove a line here THAT COMMIT WILL BE LOST.\n+EOF\n+}\n+\n make_patch () {\n \tsha1_and_parents=\"$(git rev-list --parents -1 \"$1\")\"\n \tcase \"$sha1_and_parents\" in\n@@ -901,18 +918,10 @@ test -n \"$cmd\" && add_exec_commands \"$todo\"\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\n+EOF\n+append_todo_help\n+cat >> \"$todo\" << EOF\n #\n-# Commands:\n-#  p, pick = use commit\n-#  r, reword = use commit, but edit the commit message\n-#  e, edit = use commit, but stop for amending\n-#  s, squash = use commit, but meld into previous commit\n-#  f, fixup = like \"squash\", but discard this commit's log message\n-#  x, exec = run command (the rest of the line) using shell\n-#\n-# These lines can be re-ordered; they are executed from top to bottom.\n-#\n-# If you remove a line here THAT COMMIT WILL BE LOST.\n # However, if you remove everything, the rebase will be aborted.\n #\n EOF\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199169","messageId":"1347808623-1058-2-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347808623-1058-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH v2 2/3] rebase -i: Teach \"--edit-todo\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-16T15:17:02Z","receivedAt":"2012-09-16T15:17:02Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"This allows users to edit the todo file while they're stopped in the\nmiddle of an interactive rebase. When this action is executed, all\ncomments from the original todo file are stripped, and new help messages\nare appended to the end.\n\nSigned-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n Documentation/git-rebase.txt |  5 ++++-\n git-rebase--interactive.sh   | 17 +++++++++++++++++\n git-rebase.sh                | 13 +++++++++++++\n 3 files changed, 34 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex fd535b0..da067ec 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n \t[<upstream>] [<branch>]\n 'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t--root [<branch>]\n-'git rebase' --continue | --skip | --abort\n+'git rebase' --continue | --skip | --abort | --edit-todo\n \n DESCRIPTION\n -----------\n@@ -245,6 +245,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.\n --skip::\n \tRestart the rebasing process by skipping the current patch.\n \n+--edit-todo::\n+\tEdit the todo list during an interactive rebase.\n+\n -m::\n --merge::\n \tUse merging strategies to rebase.  When the recursive (default) merge\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 4d57e50..fcd15be 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -792,6 +792,23 @@ skip)\n \n \tdo_rest\n \t;;\n+edit-todo)\n+\tsed -e '/^#/d' < \"$todo\" > \"$todo\".new\n+\tmv -f \"$todo\".new \"$todo\"\n+\tappend_todo_help\n+\tcat >> \"$todo\" << EOF\n+#\n+# You are editing the todo file of an ongoing interactive rebase.\n+# To continue rebase after editing, run:\n+#     git rebase --continue\n+#\n+EOF\n+\n+\tgit_sequence_editor \"$todo\" ||\n+\tdie_abort \"Could not execute editor\"\n+\n+\texit\n+\t;;\n esac\n \n git var GIT_COMMITTER_IDENT >/dev/null ||\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 15da926..e5a289c 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -38,6 +38,7 @@ C=!                passed to 'git apply'\n continue!          continue\n abort!             abort and check out the original branch\n skip!              skip current patch and continue\n+edit-todo!         edit the todo list during an interactive rebase\n \"\n . git-sh-setup\n . git-sh-i18n\n@@ -194,6 +195,10 @@ do\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n+\t--edit-todo)\n+\t\ttest $total_argc -eq 2 || usage\n+\t\taction=${1##--}\n+\t\t;;\n \t--onto)\n \t\ttest 2 -le \"$#\" || usage\n \t\tonto=\"$2\"\n@@ -306,6 +311,11 @@ then\n \tfi\n fi\n \n+if test \"$action\" = \"edit-todo\" && test \"$type\" != \"interactive\"\n+then\n+\tdie \"$(gettext \"The --edit-todo action can only be used during interactive rebase.\")\"\n+fi\n+\n case \"$action\" in\n continue)\n \t# Sanity check\n@@ -338,6 +348,9 @@ abort)\n \trm -r \"$state_dir\"\n \texit\n \t;;\n+edit-todo)\n+\trun_specific_rebase\n+\t;;\n esac\n \n # Make sure no rebase is in progress\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199168","messageId":"1347808623-1058-3-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347808623-1058-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH v2 3/3] rebase -i: Add tests for \"--edit-todo\"","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-16T15:17:03Z","receivedAt":"2012-09-16T15:17:03Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n t/t3404-rebase-interactive.sh | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 7304b66..6eafb63 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -911,4 +911,22 @@ test_expect_success 'rebase -i --root fixup root commit' '\n \ttest 0 = $(git cat-file commit HEAD | grep -c ^parent\\ )\n '\n \n+test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '\n+\tgit reset --hard &&\n+\tgit checkout conflict-branch &&\n+\ttest_must_fail git rebase --onto HEAD~2 HEAD~ &&\n+\ttest_must_fail git rebase --edit-todo &&\n+\tgit rebase --abort\n+'\n+\n+test_expect_success 'rebase --edit-todo can be used to modify todo' '\n+\tgit reset --hard &&\n+\tgit checkout no-conflict-branch^0 &&\n+\tFAKE_LINES=\"edit 1 2 3\" git rebase -i HEAD~3 &&\n+\tFAKE_LINES=\"2 1\" git rebase --edit-todo &&\n+\tgit rebase --continue\n+\ttest M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n+\ttest L = $(git cat-file commit HEAD | sed -ne \\$p)\n+'\n+\n test_done\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199165","messageId":"5055F51B.9070601@gmail.com","threadId":"31490","inReplyTo":"7v1ui2zccc.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] rebase -i: Teach \"--edit-todo\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-16T15:49:47Z","receivedAt":"2012-09-16T15:49:47Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"On 09/16/12 02:54, Junio C Hamano wrote:\n> In any case, what information are you discarding and then replacing\n> with the standard boilerplate?\nIt's to strip out the comment that says:\n\n    # However, if you remove everything, the rebase will be aborted.\n\nAs there's no way reliable way to know where that line is and remove it,\nthe only way I can think of is to remove all the comments, and append\nthe help messages again.\n"},{"id":"199195","messageId":"CANiSa6j2zA5P6yDaR7VU416Bzes6xbWuHbU83=BGN67Wo9j_Cw@mail.gmail.com","threadId":"31490","inReplyTo":"1347808623-1058-2-git-send-email-andrew.kw.w@gmail.com","subject":"Re: [PATCH v2 2/3] rebase -i: Teach \"--edit-todo\" action","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-17T06:11:06Z","receivedAt":"2012-09-17T06:11:06Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Sun, Sep 16, 2012 at 8:17 AM, Andrew Wong <andrew.kw.w@gmail.com> wrote:\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index fd535b0..da067ec 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -12,7 +12,7 @@ SYNOPSIS\n>         [<upstream>] [<branch>]\n>  'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n>         --root [<branch>]\n> -'git rebase' --continue | --skip | --abort\n> +'git rebase' --continue | --skip | --abort | --edit-todo\n\nI guess you should add --edit-todo to OPTIONS_SPEC in git-rebase.sh as\nwell. The OPTIONS_SPEC needs another little update too. I have\nincluded a patch at the end of this email that you include in a\nre-roll.\n\n> +       git_sequence_editor \"$todo\" ||\n> +       die_abort \"Could not execute editor\"\n\ndie_abort seems a little harsh -- it will discard the rebase state.\nPlain \"die\" would be better, I think.\n\nAlso, if you even need to break the line after the || operator, you\nmight want to indent the remainder by one tab. This file is quite\nconsistent in using that style, although I don't know what the\npreferred style is in general in git.\n\n>  git var GIT_COMMITTER_IDENT >/dev/null ||\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 15da926..e5a289c 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -194,6 +195,10 @@ do\n>                 test $total_argc -eq 2 || usage\n>                 action=${1##--}\n>                 ;;\n> +       --edit-todo)\n> +               test $total_argc -eq 2 || usage\n> +               action=${1##--}\n> +               ;;\n\nIt looks like this could be trivially combined with the previous case\narm, making the match \"--continue|--skip|--abort|--edit-todo)\".\n\n\n-->8--\nAuthor: Martin von Zweigbergk <martinvonz@gmail.com>\n\n    rebase usage: subcommands can not be combined with -i\n\n    Since 95135b0 (rebase: stricter check of standalone sub command,\n    2011-02-06), git-rebase has not allowed to use -i together with\n    e.g. --continue. Yet, when rebase started using OPTIONS_SPEC in\n    45e2acf (rebase: define options in OPTIONS_SPEC, 2011-02-28), the\n    usage message included\n\n      git-rebase [-i] --continue | --abort | --skip\n\n    Remove the \"[-i]\" from this line.\n\n    Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 15da926..e6b43a2 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -8,7 +8,7 @@ OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>]\n[<upstream>] [<branch>]\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]\n-git-rebase [-i] --continue | --abort | --skip\n+git-rebase --continue | --abort | --skip\n --\n  Available options are\n v,verbose!         display a diffstat of what changed upstream\n"},{"id":"199318","messageId":"1347931690-20625-1-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"CANiSa6j2zA5P6yDaR7VU416Bzes6xbWuHbU83=BGN67Wo9j_Cw@mail.gmail.com","subject":"[PATCH v3 0/4] rebase -i: Teach \"--edit-todo\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-18T01:28:06Z","receivedAt":"2012-09-18T01:28:06Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Made the fixes as suggested by Martin.\n\nMartin: Good points. Thanks!\n\nAndrew Wong (3):\n  rebase -i: Refactor help messages for todo file\n  rebase -i: Teach \"--edit-todo\" action\n  rebase -i: Add tests for \"--edit-todo\"\n\nMartin von Zweigbergk (1):\n  rebase usage: subcommands can not be combined with -i\n\n Documentation/git-rebase.txt  |  5 ++++-\n git-rebase--interactive.sh    | 48 +++++++++++++++++++++++++++++++++----------\n git-rebase.sh                 | 13 ++++++++++--\n t/t3404-rebase-interactive.sh | 18 ++++++++++++++++\n 4 files changed, 70 insertions(+), 14 deletions(-)\n\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199319","messageId":"1347931690-20625-2-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347931690-20625-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 1/4] rebase usage: subcommands can not be combined with -i","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-18T01:28:07Z","receivedAt":"2012-09-18T01:28:07Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"From: Martin von Zweigbergk <martinvonz@gmail.com>\n\nSince 95135b0 (rebase: stricter check of standalone sub command,\n2011-02-06), git-rebase has not allowed to use -i together with e.g.\n--continue. Yet, when rebase started using OPTIONS_SPEC in 45e2acf\n(rebase: define options in OPTIONS_SPEC, 2011-02-28), the usage message\nincluded\n\n\tgit-rebase [-i] --continue | --abort | --skip\n\nRemove the \"[-i]\" from this line.\n\nSigned-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\nSigned-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n git-rebase.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 15da926..e6b43a2 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -8,7 +8,7 @@ OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]\n-git-rebase [-i] --continue | --abort | --skip\n+git-rebase --continue | --abort | --skip\n --\n  Available options are\n v,verbose!         display a diffstat of what changed upstream\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199320","messageId":"1347931690-20625-3-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347931690-20625-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 2/4] rebase -i: Refactor help messages for todo file","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-18T01:28:08Z","receivedAt":"2012-09-18T01:28:08Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n git-rebase--interactive.sh | 31 ++++++++++++++++++++-----------\n 1 file changed, 20 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex a09e842..4d57e50 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -115,6 +115,23 @@ mark_action_done () {\n \tfi\n }\n \n+append_todo_help () {\n+\tcat >> \"$todo\" << EOF\n+#\n+# Commands:\n+#  p, pick = use commit\n+#  r, reword = use commit, but edit the commit message\n+#  e, edit = use commit, but stop for amending\n+#  s, squash = use commit, but meld into previous commit\n+#  f, fixup = like \"squash\", but discard this commit's log message\n+#  x, exec = run command (the rest of the line) using shell\n+#\n+# These lines can be re-ordered; they are executed from top to bottom.\n+#\n+# If you remove a line here THAT COMMIT WILL BE LOST.\n+EOF\n+}\n+\n make_patch () {\n \tsha1_and_parents=\"$(git rev-list --parents -1 \"$1\")\"\n \tcase \"$sha1_and_parents\" in\n@@ -901,18 +918,10 @@ test -n \"$cmd\" && add_exec_commands \"$todo\"\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\n+EOF\n+append_todo_help\n+cat >> \"$todo\" << EOF\n #\n-# Commands:\n-#  p, pick = use commit\n-#  r, reword = use commit, but edit the commit message\n-#  e, edit = use commit, but stop for amending\n-#  s, squash = use commit, but meld into previous commit\n-#  f, fixup = like \"squash\", but discard this commit's log message\n-#  x, exec = run command (the rest of the line) using shell\n-#\n-# These lines can be re-ordered; they are executed from top to bottom.\n-#\n-# If you remove a line here THAT COMMIT WILL BE LOST.\n # However, if you remove everything, the rebase will be aborted.\n #\n EOF\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199322","messageId":"1347931690-20625-4-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347931690-20625-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 3/4] rebase -i: Teach \"--edit-todo\" action","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-18T01:28:09Z","receivedAt":"2012-09-18T01:28:09Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"This allows users to edit the todo file while they're stopped in the\nmiddle of an interactive rebase. When this action is executed, all\ncomments from the original todo file are stripped, and new help messages\nare appended to the end.\n\nSigned-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n Documentation/git-rebase.txt |  5 ++++-\n git-rebase--interactive.sh   | 17 +++++++++++++++++\n git-rebase.sh                | 13 +++++++++++--\n 3 files changed, 32 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex fd535b0..da067ec 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n \t[<upstream>] [<branch>]\n 'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t--root [<branch>]\n-'git rebase' --continue | --skip | --abort\n+'git rebase' --continue | --skip | --abort | --edit-todo\n \n DESCRIPTION\n -----------\n@@ -245,6 +245,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.\n --skip::\n \tRestart the rebasing process by skipping the current patch.\n \n+--edit-todo::\n+\tEdit the todo list during an interactive rebase.\n+\n -m::\n --merge::\n \tUse merging strategies to rebase.  When the recursive (default) merge\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 4d57e50..2b8f2a9 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -792,6 +792,23 @@ skip)\n \n \tdo_rest\n \t;;\n+edit-todo)\n+\tsed -e '/^#/d' < \"$todo\" > \"$todo\".new\n+\tmv -f \"$todo\".new \"$todo\"\n+\tappend_todo_help\n+\tcat >> \"$todo\" << EOF\n+#\n+# You are editing the todo file of an ongoing interactive rebase.\n+# To continue rebase after editing, run:\n+#     git rebase --continue\n+#\n+EOF\n+\n+\tgit_sequence_editor \"$todo\" ||\n+\t\tdie \"Could not execute editor\"\n+\n+\texit\n+\t;;\n esac\n \n git var GIT_COMMITTER_IDENT >/dev/null ||\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex e6b43a2..b2f1c76 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -8,7 +8,7 @@ OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]\n-git-rebase --continue | --abort | --skip\n+git-rebase --continue | --abort | --skip | --edit-todo\n --\n  Available options are\n v,verbose!         display a diffstat of what changed upstream\n@@ -38,6 +38,7 @@ C=!                passed to 'git apply'\n continue!          continue\n abort!             abort and check out the original branch\n skip!              skip current patch and continue\n+edit-todo!         edit the todo list during an interactive rebase\n \"\n . git-sh-setup\n . git-sh-i18n\n@@ -190,7 +191,7 @@ do\n \t--verify)\n \t\tok_to_skip_pre_rebase=\n \t\t;;\n-\t--continue|--skip|--abort)\n+\t--continue|--skip|--abort|--edit-todo)\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n@@ -306,6 +307,11 @@ then\n \tfi\n fi\n \n+if test \"$action\" = \"edit-todo\" && test \"$type\" != \"interactive\"\n+then\n+\tdie \"$(gettext \"The --edit-todo action can only be used during interactive rebase.\")\"\n+fi\n+\n case \"$action\" in\n continue)\n \t# Sanity check\n@@ -338,6 +344,9 @@ abort)\n \trm -r \"$state_dir\"\n \texit\n \t;;\n+edit-todo)\n+\trun_specific_rebase\n+\t;;\n esac\n \n # Make sure no rebase is in progress\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199321","messageId":"1347931690-20625-5-git-send-email-andrew.kw.w@gmail.com","threadId":"31490","inReplyTo":"1347931690-20625-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 4/4] rebase -i: Add tests for \"--edit-todo\"","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-18T01:28:10Z","receivedAt":"2012-09-18T01:28:10Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>\n---\n t/t3404-rebase-interactive.sh | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 7304b66..6eafb63 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -911,4 +911,22 @@ test_expect_success 'rebase -i --root fixup root commit' '\n \ttest 0 = $(git cat-file commit HEAD | grep -c ^parent\\ )\n '\n \n+test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '\n+\tgit reset --hard &&\n+\tgit checkout conflict-branch &&\n+\ttest_must_fail git rebase --onto HEAD~2 HEAD~ &&\n+\ttest_must_fail git rebase --edit-todo &&\n+\tgit rebase --abort\n+'\n+\n+test_expect_success 'rebase --edit-todo can be used to modify todo' '\n+\tgit reset --hard &&\n+\tgit checkout no-conflict-branch^0 &&\n+\tFAKE_LINES=\"edit 1 2 3\" git rebase -i HEAD~3 &&\n+\tFAKE_LINES=\"2 1\" git rebase --edit-todo &&\n+\tgit rebase --continue\n+\ttest M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n+\ttest L = $(git cat-file commit HEAD | sed -ne \\$p)\n+'\n+\n test_done\n-- \n1.7.12.318.g79683ba.dirty\n"},{"id":"199328","messageId":"CANiSa6jcBWbeydMViruM1UYanhHiEugfHa5DepjGNdizq2otbA@mail.gmail.com","threadId":"31490","inReplyTo":"1347931690-20625-5-git-send-email-andrew.kw.w@gmail.com","subject":"Re: [PATCH 4/4] rebase -i: Add tests for \"--edit-todo\"","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-18T04:58:15Z","receivedAt":"2012-09-18T04:58:15Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Mon, Sep 17, 2012 at 6:28 PM, Andrew Wong <andrew.kw.w@gmail.com> wrote:\n> +       test M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n> +       test L = $(git cat-file commit HEAD | sed -ne \\$p)\n\nI couldn't find \"$\" (match last line) in the POSIX man page for sed.\nBesides, I think $(git show -s --format=%s HEAD) reads better.\n\nFor future reference, and if you haven't already, you may want to\ninstall manpages-posix (or manpages-posix-dev?) and then you can run\ne.g. \"man 1p sed\" to see the POSIX man page for sed.\n"},{"id":"199329","messageId":"5058053C.6080206@gmail.com","threadId":"31490","inReplyTo":"CANiSa6jcBWbeydMViruM1UYanhHiEugfHa5DepjGNdizq2otbA@mail.gmail.com","subject":"Re: [PATCH 4/4] rebase -i: Add tests for \"--edit-todo\"","fromName":"Andrew Wong","fromEmail":"andrew.kw.w@gmail.com","sentAt":"2012-09-18T05:23:08Z","receivedAt":"2012-09-18T05:23:08Z","isPatch":true,"sender":{"key":"andrew.kw.w@gmail.com","avatar":"https://avatars.githubusercontent.com/u/489311?v=4"},"body":"On 09/18/12 00:58, Martin von Zweigbergk wrote:\n> On Mon, Sep 17, 2012 at 6:28 PM, Andrew Wong <andrew.kw.w@gmail.com> wrote:\n>> +       test M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n>> +       test L = $(git cat-file commit HEAD | sed -ne \\$p)\n> I couldn't find \"$\" (match last line) in the POSIX man page for sed.\n> Besides, I think $(git show -s --format=%s HEAD) reads better.\nIt's under \"Addresses in sed\":\n        ... a '$' character that addresses the last line of input ...\nfrom:\n        http://pubs.opengroup.org/onlinepubs/009695399/utilities/sed.html\n\nVarious places in that test get the content of files that way, so I\nthought it's better to just follow the rest of the test. I agree that\nthere are better ways to achieve the same thing though.\n"},{"id":"199330","messageId":"CANiSa6jJTu8QmWTybN77-nMZezCVkcod-+wmEf-T7=nN-H1p=Q@mail.gmail.com","threadId":"31490","inReplyTo":"5058053C.6080206@gmail.com","subject":"Re: [PATCH 4/4] rebase -i: Add tests for \"--edit-todo\"","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-18T05:37:02Z","receivedAt":"2012-09-18T05:37:02Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Mon, Sep 17, 2012 at 10:23 PM, Andrew Wong <andrew.kw.w@gmail.com> wrote:\n> On 09/18/12 00:58, Martin von Zweigbergk wrote:\n>> On Mon, Sep 17, 2012 at 6:28 PM, Andrew Wong <andrew.kw.w@gmail.com> wrote:\n>>> +       test M = $(git cat-file commit HEAD^ | sed -ne \\$p) &&\n>>> +       test L = $(git cat-file commit HEAD | sed -ne \\$p)\n>> I couldn't find \"$\" (match last line) in the POSIX man page for sed.\n>> Besides, I think $(git show -s --format=%s HEAD) reads better.\n> It's under \"Addresses in sed\":\n>         ... a '$' character that addresses the last line of input ...\n\nAh, I just didn't look hard enough; sorry. Good to know.\n\nFWIW, Acked-by: Martin von Zweigbergk <martinvonz@gmail.com>\n"},{"id":"199340","messageId":"7va9wnq0nd.fsf@alter.siamese.dyndns.org","threadId":"31490","inReplyTo":"5055F51B.9070601@gmail.com","subject":"Re: [PATCH 2/3] rebase -i: Teach \"--edit-todo\" action","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-18T06:56:54Z","receivedAt":"2012-09-18T06:56:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Wong <andrew.kw.w@gmail.com> writes:\n\n> On 09/16/12 02:54, Junio C Hamano wrote:\n>> In any case, what information are you discarding and then replacing\n>> with the standard boilerplate?\n> It's to strip out the comment that says:\n>\n>     # However, if you remove everything, the rebase will be aborted.\n>\n> As there's no way reliable way to know where that line is and remove it,\n> the only way I can think of is to remove all the comments, and append\n> the help messages again.\n\nI see.  As long as you know that the other things you are removing\nwith the code is irrelevant and giving the standard boilerplate is\nsufficient, your approach is the simplest way to reliably get what\nyou want.\n\nThanks.\n"},{"id":"199446","messageId":"505969AA.1070509@viscovery.net","threadId":"31490","inReplyTo":"1347931690-20625-1-git-send-email-andrew.kw.w@gmail.com","subject":"[PATCH 5/4] rebase -i: suggest using --edit-todo to fix an unknown instruction","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-09-19T06:43:54Z","receivedAt":"2012-09-19T06:43:54Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nWe have now an explicit UI to edit the todo sheet and need not disclose\nthe name of the file.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n git-rebase--interactive.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 2b8f2a9..4b2ef11 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -575,11 +575,12 @@ do_next () {\n \t\t;;\n \t*)\n \t\twarn \"Unknown command: $command $sha1 $rest\"\n+\t\tfixtodo=\"Please fix this using 'git rebase --edit-todo'.\"\n \t\tif git rev-parse --verify -q \"$sha1\" >/dev/null\n \t\tthen\n-\t\t\tdie_with_patch $sha1 \"Please fix this in the file $todo.\"\n+\t\t\tdie_with_patch $sha1 \"$fixtodo\"\n \t\telse\n-\t\t\tdie \"Please fix this in the file $todo.\"\n+\t\t\tdie \"$fixtodo\"\n \t\tfi\n \t\t;;\n \tesac\n-- \n1.7.12.1721.gd1d8b74\n"},{"id":"199521","messageId":"7vvcf9g58j.fsf@alter.siamese.dyndns.org","threadId":"31490","inReplyTo":"505969AA.1070509@viscovery.net","subject":"Re: [PATCH 5/4] rebase -i: suggest using --edit-todo to fix an unknown instruction","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-19T19:52:28Z","receivedAt":"2012-09-19T19:52:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> From: Johannes Sixt <j6t@kdbg.org>\n>\n> We have now an explicit UI to edit the todo sheet and need not disclose\n> the name of the file.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  git-rebase--interactive.sh | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 2b8f2a9..4b2ef11 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -575,11 +575,12 @@ do_next () {\n>  \t\t;;\n>  \t*)\n>  \t\twarn \"Unknown command: $command $sha1 $rest\"\n> +\t\tfixtodo=\"Please fix this using 'git rebase --edit-todo'.\"\n>  \t\tif git rev-parse --verify -q \"$sha1\" >/dev/null\n>  \t\tthen\n> -\t\t\tdie_with_patch $sha1 \"Please fix this in the file $todo.\"\n> +\t\t\tdie_with_patch $sha1 \"$fixtodo\"\n>  \t\telse\n> -\t\t\tdie \"Please fix this in the file $todo.\"\n> +\t\t\tdie \"$fixtodo\"\n>  \t\tfi\n>  \t\t;;\n>  \tesac\n\nGood thinking. Makes sense to me.\n"}]}