Subject: Re: git-format-patch little gripe

From: Jakub Narebski <[email-masked]>
Date: Fri, 03 Nov 2006 21:53:58 +0100

Luben Tuikov wrote:

> --- Junio C Hamano <[email-masked]> wrote:

>> One thing we talked about but nobody stepped up to code [*1*] is
>> to give "git-format-patch --stdin" that reads list of commits,
>> and runs "git-diff-tree --pretty --stat --summary -p $commit".
>> With that, we could do something like:
>> 
>>      git rev-list linus..orinoco | git format-patch --stdin
> 
> That'd be swell to have.
> 
>> Your "git-format-patch --single $commit" is a shorthand for a
>> degenerated special case of that pattern.
> 
> Yes, except that I'd have to paste the sha-1 into the terminal
> rather than on the command line.  This again proves that the current
> git-format-patch <sha-1> to mean "<sha-1>..HEAD" is horribly broken.

First, you could have behavior you wanted by using additional option
--single, i.e. git-format-patch --single <sha-1> would mean
git-format-patch <sha-1>^..<sha-1>

But I agree that it is somewhat counter-intuitive that for all
other commands which use revision list <sha-1> means lineage
of <sha-1> while for git-format-patch it means <sha-1>..HEAD
... and we have <sha-1>.. shortcut (two characters more) to mean
the same.
 
Another command with non-obvious UI is git-format-branch, which
is not CLI equivalent of gitk/qgit (doesn't accept revision range
for example).

>> You cannot do patch-id based filtering with this form, but I see
>> that "single" is often wanted on the list and #git, and people
>> who want it do not care about patch-id based filtering at all.
> 
> The reason it is wanted is because it is _intuitive_.  This is
> what engineers (of different backgrounds) tend to intuitively think
> and assume given git's structure and the nature and meaning of
> what an <sha-1> is in git, only to be surprised later when that
> assumption is completely broken by git-format-patch.

Intuiveness is in the eye of beholder :-)

>> And I do not think it is that "they do not realize how much they
>> would be missing without patch-id filtering", in this case.  So
>> the above command line would probably be Ok.
> 
> I do not think they'd be missing _anything_.  After all,
> "git-format-patch <sha-1>..HEAD" is also intuitive.

And we have <sha-1>.. shortcut. 

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git