{"thread":{"id":"24816","subject":"[PATCH] format-patch: Update the `-3` example","startedAt":"2010-08-21T09:26:59Z","lastAt":"2010-08-21T16:49:03Z","messageCount":7,"participants":["Ramkumar Ramachandra","Jakub Narebski","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"148654","messageId":"1282382819-25097-1-git-send-email-artagnon@gmail.com","threadId":"24816","inReplyTo":null,"subject":"[PATCH] format-patch: Update the `-3` example","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:26:59Z","receivedAt":"2010-08-21T09:26:59Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"In the EXAMPLES section, `git-format-patch -3` doesn't work\nanymore. Update it to read `git format-patch HEAD~3`. The example was\nintroduced in 7c49628 and had not been updated since.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n Documentation/git-format-patch.txt |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 4b3f5ba..2a44472 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -271,7 +271,7 @@ use it only when you know the recipient uses git to apply your patch.\n as e-mailable patches:\n +\n ------------\n-$ git format-patch -3\n+$ git format-patch HEAD~3\n ------------\n \n SEE ALSO\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148663","messageId":"m3sk28nu24.fsf@localhost.localdomain","threadId":"24816","inReplyTo":"1282382819-25097-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH] format-patch: Update the `-3` example","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-08-21T10:23:59Z","receivedAt":"2010-08-21T10:23:59Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> In the EXAMPLES section, `git-format-patch -3` doesn't work\n> anymore. Update it to read `git format-patch HEAD~3`. The example was\n> introduced in 7c49628 and had not been updated since.\n> \n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  Documentation/git-format-patch.txt |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\n> index 4b3f5ba..2a44472 100644\n> --- a/Documentation/git-format-patch.txt\n> +++ b/Documentation/git-format-patch.txt\n> @@ -271,7 +271,7 @@ use it only when you know the recipient uses git to apply your patch.\n>  as e-mailable patches:\n>  +\n>  ------------\n> -$ git format-patch -3\n> +$ git format-patch HEAD~3\n>  ------------\n\nWorks for me:\n\n  5031:[gitweb/split@git]# git format-patch -3\n  0001-gitweb-Prepare-for-splitting-gitweb.txt\n  0002-gitweb-Create-Gitweb-Git-module.txt\n\n  5034:[gitweb/split@git]# git version\n  git version 1.7.2.1\n\n\nThe -3 is git-log option:\n\n  -<n>   Limits the number of commits to show.\n\nand also git-format-patch option:\n\n  -<n>   Limits the number of patches to prepare.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"148664","messageId":"20100821103404.GB31130@kytes","threadId":"24816","inReplyTo":"m3sk28nu24.fsf@localhost.localdomain","subject":"Re: [PATCH] format-patch: Update the `-3` example","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T10:34:06Z","receivedAt":"2010-08-21T10:34:06Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jakub,\n\nJakub Narebski writes:\n> Works for me:\n> \n>   5031:[gitweb/split@git]# git format-patch -3\n>   0001-gitweb-Prepare-for-splitting-gitweb.txt\n>   0002-gitweb-Create-Gitweb-Git-module.txt\n> \n>   5034:[gitweb/split@git]# git version\n>   git version 1.7.2.1\n> \n> \n> The -3 is git-log option:\n> \n>   -<n>   Limits the number of commits to show.\n> \n> and also git-format-patch option:\n> \n>   -<n>   Limits the number of patches to prepare.\n\nHm, doesn't work on the `pu` Git, but works on `master` -- I'm\ncurrently bisecting to find the problem. `git log -3` works\nthough.\n\n-- Ram\n"},{"id":"148665","messageId":"20100821105351.GC31130@kytes","threadId":"24816","inReplyTo":"20100821103404.GB31130@kytes","subject":"Re: [PATCH] format-patch: Update the `-3` example","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T10:53:54Z","receivedAt":"2010-08-21T10:53:54Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nRamkumar Ramachandra writes:\n> Hi Jakub,\n> \n> Jakub Narebski writes:\n> > Works for me:\n> > \n> >   5031:[gitweb/split@git]# git format-patch -3\n> >   0001-gitweb-Prepare-for-splitting-gitweb.txt\n> >   0002-gitweb-Create-Gitweb-Git-module.txt\n> > \n> >   5034:[gitweb/split@git]# git version\n> >   git version 1.7.2.1\n> > \n> > \n> > The -3 is git-log option:\n> > \n> >   -<n>   Limits the number of commits to show.\n> > \n> > and also git-format-patch option:\n> > \n> >   -<n>   Limits the number of patches to prepare.\n> \n> Hm, doesn't work on the `pu` Git, but works on `master` -- I'm\n> currently bisecting to find the problem. `git log -3` works\n> though.\n\n:facepalm:\n\nScratch out what I just said -- I just realized that `git format-patch\nHEAD~3` handles merge commits, but `git format-patch -3` does\nnot. `git format-patch -3 HEAD~3` is even more confusing- should we\neven advertise the `-<n>` option in format-patch?\n\n-- Ram\n"},{"id":"148668","messageId":"201008211554.27585.j6t@kdbg.org","threadId":"24816","inReplyTo":"20100821105351.GC31130@kytes","subject":"Re: [PATCH] format-patch: Update the `-3` example","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-08-21T13:54:26Z","receivedAt":"2010-08-21T13:54:26Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Samstag, 21. August 2010, Ramkumar Ramachandra wrote:\n> should we\n> even advertise the `-<n>` option in format-patch?\n\nOh, yeah! IMHO, it is its most useful option.\n\n-- Hannes\n"},{"id":"148669","messageId":"201008211659.38608.jnareb@gmail.com","threadId":"24816","inReplyTo":"20100821105351.GC31130@kytes","subject":"Re: [PATCH] format-patch: Update the `-3` example","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-08-21T14:59:37Z","receivedAt":"2010-08-21T14:59:37Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 21 Aug 2010, Ramkumar Ramachandra wrote:\n> Ramkumar Ramachandra writes:\n> > Jakub Narebski writes:\n> > > Works for me:\n> > > \n> > >   5031:[gitweb/split@git]# git format-patch -3\n> > >   0001-gitweb-Prepare-for-splitting-gitweb.txt\n> > >   0002-gitweb-Create-Gitweb-Git-module.txt\n> > > \n> > >   5034:[gitweb/split@git]# git version\n> > >   git version 1.7.2.1\n> > > \n> > > \n> > > The -3 is git-log option:\n> > > \n> > >   -<n>   Limits the number of commits to show.\n> > > \n> > > and also git-format-patch option:\n> > > \n> > >   -<n>   Limits the number of patches to prepare.\n> > \n> > Hm, doesn't work on the `pu` Git, but works on `master` -- I'm\n> > currently bisecting to find the problem. `git log -3` works\n> > though.\n> \n> :facepalm:\n> \n> Scratch out what I just said -- I just realized that `git format-patch\n> HEAD~3` handles merge commits, but `git format-patch -3` does\n> not. `git format-patch -3 HEAD~3` is even more confusing- should we\n> even advertise the `-<n>` option in format-patch?\n\nIt looks like there is a conceptual bug in how git-format-patch works, \nnamely that '-<n>' is passed to rev-list / log generating machinery, \nand it limits number of *commits* to consider; if some of those commits \nare merge commits, which cannot be represented as patches, the number \nof patches it generates is less than specified <n> (as you can see in \nthe example I have provided, where <n> == 3, and git-format-patch \ngenerated 2 patches, not 3).  In extreme case (like 'pu') it can \ngenerate no patch.\n\nI am not sure what the solution should be.  We could either:\n\nA. Update git-format-patch documentation to say 'commits' instead of\n   'patches', and perhaps also be loud about commits we are skipping,\n   so that my example would look e.g. like this:\n\n     $ git format-patch -3\n     0001-gitweb-Prepare-for-splitting-gitweb.txt\n     0002-gitweb-Create-Gitweb-Git-module.txt\n     Skipping merge commit: Merge branch 'maint'\n\nor\n\nB. Modify git-format-patch so that \"git format-patch -<n>\" would always\n   generate <n> patches from specified commits, if there are that many.\n\nBut I think that option B.) it might be difficult, so perhaps A.) is \n\"it\". \n-- \nJakub Narebski\nPoland\n"},{"id":"148672","messageId":"20100821164900.GD31130@kytes","threadId":"24816","inReplyTo":"201008211659.38608.jnareb@gmail.com","subject":"Re: [PATCH] format-patch: Update the `-3` example","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T16:49:03Z","receivedAt":"2010-08-21T16:49:03Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jakub,\n\nJakub Narebski writes:\n> On Sat, 21 Aug 2010, Ramkumar Ramachandra wrote:\n> > Ramkumar Ramachandra writes:\n> > > Jakub Narebski writes:\n> > > > Works for me:\n> > > > \n> > > >   5031:[gitweb/split@git]# git format-patch -3\n> > > >   0001-gitweb-Prepare-for-splitting-gitweb.txt\n> > > >   0002-gitweb-Create-Gitweb-Git-module.txt\n> > > > \n> > > >   5034:[gitweb/split@git]# git version\n> > > >   git version 1.7.2.1\n> > > > \n> > > > \n> > > > The -3 is git-log option:\n> > > > \n> > > >   -<n>   Limits the number of commits to show.\n> > > > \n> > > > and also git-format-patch option:\n> > > > \n> > > >   -<n>   Limits the number of patches to prepare.\n> > > \n> > > Hm, doesn't work on the `pu` Git, but works on `master` -- I'm\n> > > currently bisecting to find the problem. `git log -3` works\n> > > though.\n> > \n> > :facepalm:\n> > \n> > Scratch out what I just said -- I just realized that `git format-patch\n> > HEAD~3` handles merge commits, but `git format-patch -3` does\n> > not. `git format-patch -3 HEAD~3` is even more confusing- should we\n> > even advertise the `-<n>` option in format-patch?\n> \n> It looks like there is a conceptual bug in how git-format-patch works, \n> namely that '-<n>' is passed to rev-list / log generating machinery, \n> and it limits number of *commits* to consider; if some of those commits \n> are merge commits, which cannot be represented as patches, the number \n> of patches it generates is less than specified <n> (as you can see in \n> the example I have provided, where <n> == 3, and git-format-patch \n> generated 2 patches, not 3).  In extreme case (like 'pu') it can \n> generate no patch.\n> \n> I am not sure what the solution should be.  We could either:\n> \n> A. Update git-format-patch documentation to say 'commits' instead of\n>    'patches', and perhaps also be loud about commits we are skipping,\n>    so that my example would look e.g. like this:\n> \n>      $ git format-patch -3\n>      0001-gitweb-Prepare-for-splitting-gitweb.txt\n>      0002-gitweb-Create-Gitweb-Git-module.txt\n>      Skipping merge commit: Merge branch 'maint'\n\nThanks for the awesome explanation! A is definitely the way to go-\nI'll start writing a patch immediately.\n\n-- Ram\n"}]}