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

Re: Bug(feature?) on git-diff-files

From
Jeff King <peff@peff.net>
Date
Apr 11, 2019, 12:57 UTC
Message-ID
<20190411125703.GA26995@sigill.intra.peff.net>
In-Reply-To
<CABgj7us=Rk3EUvd2EVVqsYKDUGS7VfAX09SpW04fB26cgntw5g@mail.gmail.com>
On Thu, Apr 11, 2019 at 03:47:58PM +0300, NoName Req wrote:
Show 14 quoted lines
> Summary
>    `git -C (folder path) diff-files --name-only` output is not correct
> 
> Steps to Reproduce
> 1. Apply change to a clean git repository. Go to another folder (not
> within this repository) and apply the command
>    `git -C repo-path diff-files --name-only`
> The above command lists dirty files in that repository.
> 2. Now undo your changes on the repository
> 3. Issue the same command. It still lists the file.
> 
> More Information
> 
> `git -C repo-path diff`  command doesn't seem to have this problem.
Try running `git update-index --refresh` before running `diff-files`.

Unlike git-diff, git-diff-files is plumbing that is meant to be called from scripts. So it is up to the script writer to decide when the index should be refreshed from the actual filesystem (which makes sense, e.g., if you're going to do it once at the start of the script and then make a bunch of separate diff-related calls).

Until that happens, diff-files will see only that the entry is stat-dirty, and report it as a potential change.

-Peff
Previous: NoName ReqNext: Duy Nguyen
Message 2 of 4 in “Bug(feature?) on git-diff-files”
  1. NoName ReqApr 11, 2019
  2. Jeff KingApr 11, 2019
  3. Duy NguyenApr 11, 2019
  4. NoName ReqApr 12, 2019

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.