From: Ramkumar Ramachandra Date: Sat, 21 Aug 2010 16:49:03 GMT Subject: Re: [PATCH] format-patch: Update the `-3` example Message-ID: <20100821164900.GD31130@kytes> In-Reply-To: <201008211659.38608.jnareb@gmail.com> Hi Jakub, Jakub Narebski writes: > On Sat, 21 Aug 2010, Ramkumar Ramachandra wrote: > > Ramkumar Ramachandra writes: > > > Jakub Narebski writes: > > > > Works for me: > > > > > > > > 5031:[gitweb/split@git]# git format-patch -3 > > > > 0001-gitweb-Prepare-for-splitting-gitweb.txt > > > > 0002-gitweb-Create-Gitweb-Git-module.txt > > > > > > > > 5034:[gitweb/split@git]# git version > > > > git version 1.7.2.1 > > > > > > > > > > > > The -3 is git-log option: > > > > > > > > - Limits the number of commits to show. > > > > > > > > and also git-format-patch option: > > > > > > > > - Limits the number of patches to prepare. > > > > > > Hm, doesn't work on the `pu` Git, but works on `master` -- I'm > > > currently bisecting to find the problem. `git log -3` works > > > though. > > > > :facepalm: > > > > Scratch out what I just said -- I just realized that `git format-patch > > HEAD~3` handles merge commits, but `git format-patch -3` does > > not. `git format-patch -3 HEAD~3` is even more confusing- should we > > even advertise the `-` option in format-patch? > > It looks like there is a conceptual bug in how git-format-patch works, > namely that '-' is passed to rev-list / log generating machinery, > and it limits number of *commits* to consider; if some of those commits > are merge commits, which cannot be represented as patches, the number > of patches it generates is less than specified (as you can see in > the example I have provided, where == 3, and git-format-patch > generated 2 patches, not 3). In extreme case (like 'pu') it can > generate no patch. > > I am not sure what the solution should be. We could either: > > A. Update git-format-patch documentation to say 'commits' instead of > 'patches', and perhaps also be loud about commits we are skipping, > so that my example would look e.g. like this: > > $ git format-patch -3 > 0001-gitweb-Prepare-for-splitting-gitweb.txt > 0002-gitweb-Create-Gitweb-Git-module.txt > Skipping merge commit: Merge branch 'maint' Thanks for the awesome explanation! A is definitely the way to go- I'll start writing a patch immediately. -- Ram