{"thread":{"id":"26993","subject":"rebase autosquash doesn't recognise a chain of fixups","startedAt":"2011-04-05T15:41:00Z","lastAt":"2011-04-05T21:03:12Z","messageCount":7,"participants":["Carlos Martín Nieto","Vincent van Ravesteijn","Junio C Hamano","Kevin Ballard"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"165180","messageId":"20110405154100.GC16031@bee.lab.cmartin.tk","threadId":"26993","inReplyTo":null,"subject":"rebase autosquash doesn't recognise a chain of fixups","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2011-04-05T15:41:00Z","receivedAt":"2011-04-05T15:41:00Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"Hello,\n\n Say I have the following commits:\n\n    5154127 fixup! fixup! one\n    0d130d8 fixup! one\n    0869d30 one\n\nbecause I keep executing `git commit -a --fixup HEAD`. When I want to\nsquash them all into 0869d30, I do `git rebase -i --autosquash\n0869d30^` and I get\n\n    pick 0869d30 one\n    fixup 0d130d8 fixup! one\n    pick 5154127 fixup! fixup! one\n\nwhen I was hoping for\n\n    pick 0869d30 one\n    fixup 0d130d8 fixup! one\n    fixup 5154127 fixup! fixup! one\n\nChanging the options to the latter one works (as in, the patches\napply). Is this expected? Am I just too lazy and should look up the\ncommit I want to fixup?\n\n   cmn\n"},{"id":"165181","messageId":"4D9B39EB.9040208@lyx.org","threadId":"26993","inReplyTo":"20110405154100.GC16031@bee.lab.cmartin.tk","subject":"Re: rebase autosquash doesn't recognise a chain of fixups","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2011-04-05T15:48:59Z","receivedAt":"2011-04-05T15:48:59Z","isPatch":false,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"On 5-4-2011 17:41, Carlos Martín Nieto wrote:\n> Hello,\n>\n>   Say I have the following commits:\n>\n>      5154127 fixup! fixup! one\n>      0d130d8 fixup! one\n>      0869d30 one\n>\n> because I keep executing `git commit -a --fixup HEAD`.\n>\n> Am I just too lazy and should look up the commit I want to fixup?\n\nI would use 'git commit --amend -a' instead if I am already sure that I \nwant to squash my commit into the previous one.\n\nVincent\n"},{"id":"165182","messageId":"20110405160336.GA20336@bee.lab.cmartin.tk","threadId":"26993","inReplyTo":"4D9B39EB.9040208@lyx.org","subject":"Re: rebase autosquash doesn't recognise a chain of fixups","fromName":"Carlos Martín Nieto","fromEmail":"carlos@cmartin.tk","sentAt":"2011-04-05T16:03:36Z","receivedAt":"2011-04-05T16:03:36Z","isPatch":false,"sender":{"key":"carlos@cmartin.tk","avatar":"https://gravatar.com/avatar/956bfe8371004f2960febf266a6af789f60cdc01fbae48bb151ad4c9b532c3a2?d=mp&s=160"},"body":"On Tue, Apr 05, 2011 at 05:48:59PM +0200, Vincent van Ravesteijn wrote:\n> On 5-4-2011 17:41, Carlos Martín Nieto wrote:\n> >Hello,\n> >\n> >  Say I have the following commits:\n> >\n> >     5154127 fixup! fixup! one\n> >     0d130d8 fixup! one\n> >     0869d30 one\n> >\n> >because I keep executing `git commit -a --fixup HEAD`.\n> >\n> >Am I just too lazy and should look up the commit I want to fixup?\n> \n> I would use 'git commit --amend -a' instead if I am already sure\n> that I want to squash my commit into the previous one.\n\n That does make more sense. I guess I was just too excited about\n discovering fixups :)\n\n   cmn\n"},{"id":"165189","messageId":"7v4o6cob4t.fsf@alter.siamese.dyndns.org","threadId":"26993","inReplyTo":"20110405154100.GC16031@bee.lab.cmartin.tk","subject":"Re: rebase autosquash doesn't recognise a chain of fixups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-05T17:34:26Z","receivedAt":"2011-04-05T17:34:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carlos Martín Nieto <cmn@elego.de> writes:\n\n>  Say I have the following commits:\n>\n>     5154127 fixup! fixup! one\n>     0d130d8 fixup! one\n>     0869d30 one\n>\n> because I keep executing `git commit -a --fixup HEAD`. When I want to\n> squash them all into 0869d30, I do `git rebase -i --autosquash\n> 0869d30^` and I get\n>\n>     pick 0869d30 one\n>     fixup 0d130d8 fixup! one\n>     pick 5154127 fixup! fixup! one\n\nThe way Kevin's d3d7a42 (rebase: better rearranging of fixup!/squash!\nlines with --autosquash, 2010-11-04) series works is to match \"fixup!\"\nonly with \"pick\"; a later \"fixup!\" never matches an earlier \"fixup!\" but a\n\"pick\" can be matched against more than one \"fixup!\".\n\nI think one way to make this work is to fix what Pat did in d71b8ba\n(commit: --fixup option for use with rebase --autosquash, 2010-11-02).\n\nPerhaps like this, but I'll leave additions of test scripts to t3415 to\nothers.\n\n-- >8 --\nSubject: commit --fixup: do not duplicate \"fixup! \" at the beginning\n\nThe \"rebase -i\" command can match more than one \"fixup!\" against a single\n\"pick\" in the right order thanks to the earlier d3d7a42 (rebase: better\nrearranging of fixup!/squash! lines with --autosquash, 2010-11-04), but a\n\"fixup!\" entry is never matched with another \"fixup!\" entry.\n\nWhen creating a commit marked to fix up an earlier commit with --fixup, we\ncan mark it to look for the original and fix that one up.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/commit.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 67757e9..b3c4d63 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -668,6 +668,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\tctx.output_encoding = get_commit_output_encoding();\n \t\tformat_commit_message(commit, \"fixup! %s\\n\\n\",\n \t\t\t\t      &sb, &ctx);\n+\t\twhile (!prefixcmp(sb.buf, \"fixup! fixup!\"))\n+\t\t\tstrbuf_splice(&sb, 0, 7, \"\", 0);\n \t\thook_arg1 = \"message\";\n \t} else if (!stat(git_path(\"MERGE_MSG\"), &statbuf)) {\n \t\tif (strbuf_read_file(&sb, git_path(\"MERGE_MSG\"), 0) < 0)\n"},{"id":"165201","messageId":"B584DA91-1811-4976-A915-458672455DAD@sb.org","threadId":"26993","inReplyTo":"7v4o6cob4t.fsf@alter.siamese.dyndns.org","subject":"Re: rebase autosquash doesn't recognise a chain of fixups","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2011-04-05T18:02:06Z","receivedAt":"2011-04-05T18:02:06Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"This seems unnecessary. `git commit --fixup HEAD` doesn't really make any sense at all to run when you can say `git commit --amend` instead,\n\n-Kevin\n\nOn Apr 5, 2011, at 10:34 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> Carlos Martín Nieto <cmn@elego.de> writes:\n> \n>> Say I have the following commits:\n>> \n>>    5154127 fixup! fixup! one\n>>    0d130d8 fixup! one\n>>    0869d30 one\n>> \n>> because I keep executing `git commit -a --fixup HEAD`. When I want to\n>> squash them all into 0869d30, I do `git rebase -i --autosquash\n>> 0869d30^` and I get\n>> \n>>    pick 0869d30 one\n>>    fixup 0d130d8 fixup! one\n>>    pick 5154127 fixup! fixup! one\n> \n> The way Kevin's d3d7a42 (rebase: better rearranging of fixup!/squash!\n> lines with --autosquash, 2010-11-04) series works is to match \"fixup!\"\n> only with \"pick\"; a later \"fixup!\" never matches an earlier \"fixup!\" but a\n> \"pick\" can be matched against more than one \"fixup!\".\n> \n> I think one way to make this work is to fix what Pat did in d71b8ba\n> (commit: --fixup option for use with rebase --autosquash, 2010-11-02).\n> \n> Perhaps like this, but I'll leave additions of test scripts to t3415 to\n> others.\n> \n> -- >8 --\n> Subject: commit --fixup: do not duplicate \"fixup! \" at the beginning\n> \n> The \"rebase -i\" command can match more than one \"fixup!\" against a single\n> \"pick\" in the right order thanks to the earlier d3d7a42 (rebase: better\n> rearranging of fixup!/squash! lines with --autosquash, 2010-11-04), but a\n> \"fixup!\" entry is never matched with another \"fixup!\" entry.\n> \n> When creating a commit marked to fix up an earlier commit with --fixup, we\n> can mark it to look for the original and fix that one up.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n> builtin/commit.c |    2 ++\n> 1 files changed, 2 insertions(+), 0 deletions(-)\n> \n> diff --git a/builtin/commit.c b/builtin/commit.c\n> index 67757e9..b3c4d63 100644\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -668,6 +668,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n>        ctx.output_encoding = get_commit_output_encoding();\n>        format_commit_message(commit, \"fixup! %s\\n\\n\",\n>                      &sb, &ctx);\n> +        while (!prefixcmp(sb.buf, \"fixup! fixup!\"))\n> +            strbuf_splice(&sb, 0, 7, \"\", 0);\n>        hook_arg1 = \"message\";\n>    } else if (!stat(git_path(\"MERGE_MSG\"), &statbuf)) {\n>        if (strbuf_read_file(&sb, git_path(\"MERGE_MSG\"), 0) < 0)\n"},{"id":"165197","messageId":"7vk4f8mu4i.fsf@alter.siamese.dyndns.org","threadId":"26993","inReplyTo":"B584DA91-1811-4976-A915-458672455DAD@sb.org","subject":"Re: rebase autosquash doesn't recognise a chain of fixups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-05T18:27:09Z","receivedAt":"2011-04-05T18:27:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Ballard <kevin@sb.org> writes:\n\n> This seems unnecessary. `git commit --fixup HEAD` doesn't really make any sense at all to run when you can say `git commit --amend` instead,\n\nWhat about this sequence?\n\n\tgit commit -m 'foo'\n        git commit -m 'bar'\n        git commit --fixup HEAD~1\n        git commit -m 'baz'\n        git commit --fixup HEAD~1\n"},{"id":"165210","messageId":"7v8vvommwf.fsf@alter.siamese.dyndns.org","threadId":"26993","inReplyTo":"BANLkTimqvu7c559_AQ6yLxPACOxD0ciNxQ@mail.gmail.com","subject":"Re: rebase autosquash doesn't recognise a chain of fixups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-05T21:03:12Z","receivedAt":"2011-04-05T21:03:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Ballard <kevin@sb.org> writes:\n\n> On Tue, Apr 5, 2011 at 11:27 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> Kevin Ballard <kevin@sb.org> writes:\n>>\n>> > This seems unnecessary. `git commit --fixup HEAD` doesn't really make any\n>> sense at all to run when you can say `git commit --amend` instead,\n>>\n>> What about this sequence?\n>>\n>>        git commit -m 'foo'\n>>        git commit -m 'bar'\n>>        git commit --fixup HEAD~1\n>>        git commit -m 'baz'\n>>        git commit --fixup HEAD~1\n>>\n>>\n> You raise a good point. I personally think someone who types that deserves\n> what he gets, but I have no objection to being intelligent about duplicate\n> fixup! prefixes.\n\nOf course an alternative solution is to fix this on the \"rebase -i\" side,\nby building on top of your d3d7a42 (rebase: better rearranging of\nfixup!/squash! lines with --autosquash, 2010-11-04).\n\nOr perhaps we would want to do both.\n"}]}