All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] format-patch: Update the `-3` example
Date: Sat, 21 Aug 2010 16:59:37 +0200	[thread overview]
Message-ID: <201008211659.38608.jnareb@gmail.com> (raw)
In-Reply-To: <20100821105351.GC31130@kytes>

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:
> > > 
> > >   -<n>   Limits the number of commits to show.
> > > 
> > > and also git-format-patch option:
> > > 
> > >   -<n>   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 `-<n>` option in format-patch?

It looks like there is a conceptual bug in how git-format-patch works, 
namely that '-<n>' 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 <n> (as you can see in 
the example I have provided, where <n> == 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'

or

B. Modify git-format-patch so that "git format-patch -<n>" would always
   generate <n> patches from specified commits, if there are that many.

But I think that option B.) it might be difficult, so perhaps A.) is 
"it". 
-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2010-08-21 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21  9:26 [PATCH] format-patch: Update the `-3` example Ramkumar Ramachandra
2010-08-21 10:23 ` Jakub Narebski
2010-08-21 10:34   ` Ramkumar Ramachandra
2010-08-21 10:53     ` Ramkumar Ramachandra
2010-08-21 13:54       ` Johannes Sixt
2010-08-21 14:59       ` Jakub Narebski [this message]
2010-08-21 16:49         ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201008211659.38608.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.