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

Re: Misleading documentation for git-diff-files (diff-filter)

From
JCJohn Cheng <johnlicheng@gmail.com>
Date
Jan 4, 2018, 15:53 UTC
Message-ID
<CAJzZBAQ_T3JDqsxy=s7gbrRQjDsdZODB8XsBb4TUCs1K1Bmnjw@mail.gmail.com>
In-Reply-To
<xmqqvagifqj8.fsf@gitster.mtv.corp.google.com>

To be clear, I don't mean to imply that diff-files should include files that are not the index. I was trying to say that as a user, the documentation gave me a different impression.

For background, my intent was to have a script to look for local git repos that with unstaged changes. After some trial and error, I found that git-ls-files gave me what I needed. However, I wanted to point out why I initially believed git-diff-files with show "added files". Think of this more as user feedback.

On Wed, Jan 3, 2018 at 3:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> John Cheng <johnlicheng@gmail.com> writes:
>
>> I wanted to know if git diff-files shows files that are not in the
>> index but are in the working tree.
>
> At least in the original design of Git, that would fundamentally be
> impossible, as Git _only_ cares about paths that are in the index,
> so a new file won't be in the picture until it is added.  Because a
> change is shown as "A"dded by the diff family of commands only when
> the old side lacks a path that appears in the new side, there is no
> way "diff-files" that compares the index and the working tree would
> see a path that is missing from the old (i.e. the index) side.
-- 
---
John L Cheng
Previous: Junio C HamanoNext: Jeff King
Message 3 of 6 in “Misleading documentation for git-diff-files (diff-filter)”
  1. John ChengJan 3, 2018
  2. Junio C HamanoJan 3, 2018
  3. John ChengJan 4, 2018
  4. Jeff KingJan 4, 2018
  5. Junio C HamanoJan 4, 2018
  6. John ChengJan 4, 2018

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.