git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Santi Béjar" <santi@agolina.net>
To: Yann Dirson <dirson@bertin.fr>
Cc: git@vger.kernel.org
Subject: Re: Undocumented git-diff syntax
Date: Mon, 11 Oct 2010 16:52:46 +0200	[thread overview]
Message-ID: <AANLkTikBxBMm-Pv_8M7SxEugQ5pdksm_k=ihAa4toVap@mail.gmail.com> (raw)
In-Reply-To: <20101011161721.35940919@chalon.bertin.fr>

On Mon, Oct 11, 2010 at 4:17 PM, Yann Dirson <dirson@bertin.fr> wrote:
> On Mon, 11 Oct 2010 15:59:18 +0200
> Santi Béjar <santi@agolina.net> wrote:
>
>> On Mon, Oct 11, 2010 at 3:03 PM, Yann Dirson <dirson@bertin.fr> 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

  reply	other threads:[~2010-10-11 14:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 13:03 Undocumented git-diff syntax Yann Dirson
2010-10-11 13:59 ` Santi Béjar
2010-10-11 14:17   ` Yann Dirson
2010-10-11 14:52     ` Santi Béjar [this message]
2010-10-11 16:02     ` [PATCH 0/4] " Jonathan Nieder
2010-10-11 16:03       ` [PATCH 1/5] Documentation: gitrevisions is in section 7 Jonathan Nieder
2010-10-11 20:49         ` Sverre Rabbelier
2010-10-11 16:04       ` [PATCH 2/4] Documentation: diff can compare blobs Jonathan Nieder
2010-10-11 16:05       ` [PATCH 3/4] Documentation: expand 'git diff' SEE ALSO section Jonathan Nieder
2010-10-11 16:06       ` [PATCH 4/4] Documentation: update "git diff --no-index" description Jonathan Nieder
2010-10-11 16:07       ` [RFC/PATCH 5/4] Documentation: flesh out diff --no-index description Jonathan Nieder
2010-10-13 22:40         ` Junio C Hamano
2010-10-11 18:52       ` [PATCH 0/4] Re: Undocumented git-diff syntax Yann Dirson
2010-10-11 20:56       ` Sverre Rabbelier
2010-10-11 16:57     ` Jakub Narebski

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='AANLkTikBxBMm-Pv_8M7SxEugQ5pdksm_k=ihAa4toVap@mail.gmail.com' \
    --to=santi@agolina.net \
    --cc=dirson@bertin.fr \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).