git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Undocumented git-diff syntax

From
SBSanti Béjar <santi@agolina.net>
Date
Oct 11, 2010, 14:52 UTC
Message-ID
<AANLkTikBxBMm-Pv_8M7SxEugQ5pdksm_k=ihAa4toVap@mail.gmail.com>
In-Reply-To
<20101011161721.35940919@chalon.bertin.fr>
On Mon, Oct 11, 2010 at 4:17 PM, Yann Dirson <dirson@bertin.fr> wrote:
Show 29 quoted lines
> 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
Previous: Yann DirsonNext: Jonathan Nieder
Message 4 of 15 in “Undocumented git-diff syntax”
  1. Yann DirsonOct 11, 2010
  2. Santi BéjarOct 11, 2010
  3. Yann DirsonOct 11, 2010
  4. Santi BéjarOct 11, 2010
  5. 0/4 Re: Undocumented git-diff syntaxJonathan Nieder, Oct 11, 2010
  6. 1/5 Documentation: gitrevisions is in section 7Jonathan Nieder, Oct 11, 2010
  7. Sverre RabbelierOct 11, 2010
  8. 2/4 Documentation: diff can compare blobsJonathan Nieder, Oct 11, 2010
  9. 3/4 Documentation: expand 'git diff' SEE ALSO sectionJonathan Nieder, Oct 11, 2010
  10. 4/4 Documentation: update "git diff --no-index" descriptionJonathan Nieder, Oct 11, 2010
  11. 5/4 Documentation: flesh out diff --no-index descriptionJonathan Nieder, Oct 11, 2010
  12. Junio C HamanoOct 13, 2010
  13. Yann DirsonOct 11, 2010
  14. Sverre RabbelierOct 11, 2010
  15. Jakub NarebskiOct 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.