{"thread":{"id":"36104","subject":"[PATCH] rebase: new option to post edit a squashed or fixed up commit","startedAt":"2014-03-09T03:12:17Z","lastAt":"2014-03-11T10:01:55Z","messageCount":3,"participants":["Nguyễn Thái Ngọc Duy","Junio C Hamano","Duy Nguyen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"236332","messageId":"1394334737-17406-1-git-send-email-pclouds@gmail.com","threadId":"36104","inReplyTo":null,"subject":"[PATCH] rebase: new option to post edit a squashed or fixed up commit","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2014-03-09T03:12:17Z","receivedAt":"2014-03-09T03:12:17Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"After squashing or fixing up, you may want to have a final look at the\ncommit, edit some more if needed or even do some testing. --postedit\nenables that. This is (to me) a paranoid mode so either I enable it\nfor all squashes and fixups, or none. Hence a new option, not new todo\ncommands that give finer selection.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/git-rebase.txt | 5 +++++\n git-rebase--interactive.sh   | 5 +++++\n git-rebase.sh                | 7 +++++++\n 3 files changed, 17 insertions(+)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 2a93c64..dacb163 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -432,6 +432,11 @@ recreates the topic branch with fresh commits so it can be remerged\n successfully without needing to \"revert the reversion\" (see the\n link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).\n \n+--[no-]postedit::\n+\tWith --interactive, stop after performing the command \"squash\"\n+\tor \"fixup\". This gives the user a chance to look at the final\n+\tcommit and update or test it if needed.\n+\n include::merge-strategies.txt[]\n \n NOTES\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex a1adae8..42061fc 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -571,6 +571,11 @@ do_next () {\n \t\t\t;;\n \t\tesac\n \t\trecord_in_rewritten $sha1\n+\t\tif test -n \"$postedit\"\n+\t\tthen\n+\t\t\twarn \"Stopped at $sha1... $rest\"\n+\t\t\texit_with_patch $sha1 0\n+\t\tfi\n \t\t;;\n \tx|\"exec\")\n \t\tread -r command rest < \"$todo\"\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 5f6732b..2d4beb7 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -32,6 +32,7 @@ verify             allow pre-rebase hook to run\n rerere-autoupdate  allow rerere to update index with resolved conflicts\n root!              rebase all reachable commits up to the root(s)\n autosquash         move commits that begin with squash!/fixup! under -i\n+postedit           stop after squash or fixup commands\n committer-date-is-author-date! passed to 'git am'\n ignore-date!       passed to 'git am'\n whitespace=!       passed to 'git apply'\n@@ -264,6 +265,12 @@ do\n \t--no-autosquash)\n \t\tautosquash=\n \t\t;;\n+\t--postedit)\n+\t\tpostedit=t\n+\t\t;;\n+\t--no-postedit)\n+\t\tpostedit=\n+\t\t;;\n \t--fork-point)\n \t\tfork_point=t\n \t\t;;\n-- \n1.9.0.40.gaa8c3ea\n"},{"id":"236444","messageId":"xmqqob1drg3b.fsf@gitster.dls.corp.google.com","threadId":"36104","inReplyTo":"1394334737-17406-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] rebase: new option to post edit a squashed or fixed up commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-10T19:47:20Z","receivedAt":"2014-03-10T19:47:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> After squashing or fixing up, you may want to have a final look at the\n> commit, edit some more if needed or even do some testing. --postedit\n> enables that. This is (to me) a paranoid mode so either I enable it\n> for all squashes and fixups, or none. Hence a new option, not new todo\n> commands that give finer selection.\n\nIf we were to adopt Michael's (?) idea of allowing flags to each\ninsn in the insn sheet, would this restriction be easily lifted?\n\nThat is, instead of saying \"squash\", you say \"squash --stop\" or\nsomething.\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index a1adae8..42061fc 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -571,6 +571,11 @@ do_next () {\n>  \t\t\t;;\n>  \t\tesac\n>  \t\trecord_in_rewritten $sha1\n> +\t\tif test -n \"$postedit\"\n> +\t\tthen\n> +\t\t\twarn \"Stopped at $sha1... $rest\"\n> +\t\t\texit_with_patch $sha1 0\n> +\t\tfi\n>  \t\t;;\n\nI would have expected that any new code would stop only at the last\nsquash (or fixup) in a series of squashes, but this appears to stop\neven at an intermediate squashed result, which will not appear in\nthe final history.  Am I misreading the patch (or misunderstanding\nthe intent of the patch)?\n"},{"id":"236490","messageId":"CACsJy8C4xs+EsXshR8ppb063uv=cBBB+evgaVaZXt+NATk6SJQ@mail.gmail.com","threadId":"36104","inReplyTo":"xmqqob1drg3b.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] rebase: new option to post edit a squashed or fixed up commit","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-03-11T10:01:55Z","receivedAt":"2014-03-11T10:01:55Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Mar 11, 2014 at 2:47 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n>\n>> After squashing or fixing up, you may want to have a final look at the\n>> commit, edit some more if needed or even do some testing. --postedit\n>> enables that. This is (to me) a paranoid mode so either I enable it\n>> for all squashes and fixups, or none. Hence a new option, not new todo\n>> commands that give finer selection.\n>\n> If we were to adopt Michael's (?) idea of allowing flags to each\n> insn in the insn sheet, would this restriction be easily lifted?\n>\n> That is, instead of saying \"squash\", you say \"squash --stop\" or\n> something.\n\nI think I still need something similar, otherwise I would need to\ns/squash/squash --stop/ after \"rebase -i --autosquash\". --postedit\ncode could be simplified by generating \"squash --stop\" though.\n\n>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n>> index a1adae8..42061fc 100644\n>> --- a/git-rebase--interactive.sh\n>> +++ b/git-rebase--interactive.sh\n>> @@ -571,6 +571,11 @@ do_next () {\n>>                       ;;\n>>               esac\n>>               record_in_rewritten $sha1\n>> +             if test -n \"$postedit\"\n>> +             then\n>> +                     warn \"Stopped at $sha1... $rest\"\n>> +                     exit_with_patch $sha1 0\n>> +             fi\n>>               ;;\n>\n> I would have expected that any new code would stop only at the last\n> squash (or fixup) in a series of squashes, but this appears to stop\n> even at an intermediate squashed result, which will not appear in\n> the final history.  Am I misreading the patch (or misunderstanding\n> the intent of the patch)?\n\nNever thought of that case. Yes it should only stop at the last squash/fixup.\n-- \nDuy\n"}]}