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

Re: About git-diff

From
Andreas Schwab <schwab@linux-m68k.org>
Date
Aug 10, 2011, 17:01 UTC
Message-ID
<m2hb5pb3pe.fsf@igel.home>
In-Reply-To
<1312941177.17928.YahooMailClassic@web121810.mail.ne1.yahoo.com>
Luiz Ramos <luizzramos@yahoo.com.br> writes:
Show 12 quoted lines
> If I run:
>
> $ git diff b2 ./
>
> that is, the "non-cached" version, it will show the same results. This is
> confusing IMHO, because the git-diff manual suggests that invocation
> should render the difference between the named tree contents and the
> working directory. In the working directory, only to recall, file_1 and
> file_2 are both present and with good versions. In my understanding, the
> command should report that file_1 is in excess in the working directory,
> relative to b2, and report nothing about file_2, as it is in the same
> version as the sample in the tree b2.

Since file_2 is not tracked in the current branch, its existence in the directory is ignored.

Show 8 quoted lines
> This doesn't seem to be the same thing git-diff-index manual states,
> however. The manual gets more deep into the details, and it's not so easy
> to understand it unless one knows a lot of the inner commands, which does
> not apply to me. In my basic reading, it seems that behind the scenes,
> git-diff-index is what is run in this case, and the fact that file_2 is
> not in the tree associated to b1 is a relevant thing in this case. So, the
> index seem to matter, and if I try to do it, a previous "git update-index"
> should be done.
It's not the index, but the current tree that matters:
           show me the differences between HEAD and the currently checked out
           tree - index contents _and_ files that aren't up-to-date

Note that it talks about "files that aren't up-to-date". Thus untracked files are not considered.

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Previous: Luiz RamosNext: Luiz Ramos
Message 2 of 5 in “About git-diff”
  1. Luiz RamosAug 10, 2011
  2. Andreas SchwabAug 10, 2011
  3. Luiz RamosAug 11, 2011
  4. Junio C HamanoAug 11, 2011
  5. Luiz RamosAug 11, 2011

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.