Re: Undocumented git-diff syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 11, 2010 at 4:17 PM, Yann Dirson <dirson@xxxxxxxxx> wrote:
> On Mon, 11 Oct 2010 15:59:18 +0200
> Santi Béjar <santi@xxxxxxxxxxx> wrote:
>
>> On Mon, Oct 11, 2010 at 3:03 PM, Yann Dirson <dirson@xxxxxxxxx> wrote:
>> [...]
>> >
>> > Another thought: if we can already compare arbitrary blobs, maybe
>> > it would not be so hard to extend it to take arbitrary contents
>> > that are not stored as blobs yet ?  (a quick hack would be to
>> > insert an object for them, but that does not look too clean...).
>> >  As a use-case, I'm often found generating diffs from within custom
>> > scripts, from contents derived from a git repo, but can't use all
>> > the bells and whistles (--color, --color-words, etc), just because
>> > I have to use plain diff; that makes the output of those scripts
>> > very inconsistent with native git commands.
>>
>> Are you talking about "git diff --no-index"?
>
> Oh, right.  That's what it takes to read only the 1st paragraph for
> each synopsis:
>
> |If exactly two paths are given, and at least one is untracked,
> |compare the two files / directories. This behavior can be
> |forced by --no-index.
>
> OTOH, that appears not to be 100% accurate (my tests would have
> shown me): although --no-index does give me the expected results when
> one or two of the files are untracked, I have to explicitely add it,
> which seem to contradict this part of the doc.

You are right.

Additionally these two are not equivalent:

$ git diff Makefile ../Makefile
fatal: '../Makefile' is outside repository

$ git diff Makefile $HOME/Makefile
diff --git ...

(with --no-index both work)

>
> That said, this two-path construct would surely deserve its own
> synopsis.

+1

Santi
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]