Re: "git diff-files" command reports differences that don't exist

3 messages, 3 authors, 2021-03-05 · open the first message on its own page

Re: "git diff-files" command reports differences that don't exist

From: Junio C Hamano <hidden>
Date: 2021-03-05 21:50:16

Michael Brown [off-list ref] writes:
What did you do before the bug happened? (Steps to reproduce your issue)

1. Be in any existing repository in a clean state (I tested with 2 existing
   repositories and 1 completely fresh)
1. run `git diff-files`, see no output
1. touch an existing file: `touch a`
1. run `git diff-files`
This is totally expected behaviour.  In general when you are working
with plumbing commands like diff-files and diff-index, you are
expected to do "update-index --refresh" upfront.

A plumbing command "git diff" has an equivalent of "update-index
--refresh" built into it, but the plumbing commands are designed
to be used in scripts, and in order to allow scripting programmers
to avoid making unnecessary "update-index --refresh", e.g.

	git update-index --refresh
	git diff-files | use diff-files output
	git diff-index | use diff-index output

they leave it the responsibility of the calling script (or the end
user who directly use them from the command line) to refresh the
cached stat information as necessary.


Re: "git diff-files" command reports differences that don't exist

From: Eric Sunshine <hidden>
Date: 2021-03-05 22:19:24

On Fri, Mar 5, 2021 at 4:50 PM Junio C Hamano [off-list ref] wrote:
This is totally expected behaviour.  In general when you are working
with plumbing commands like diff-files and diff-index, you are
expected to do "update-index --refresh" upfront.

A plumbing command "git diff" has an equivalent of "update-index
--refresh" built into it, but the plumbing commands are designed
to be used in scripts, and in order to allow scripting programmers
to avoid making unnecessary "update-index --refresh", e.g.
Did you mean:

    A porcelain command "git diff" has an equivalent...

?

Re: "git diff-files" command reports differences that don't exist

From: Michael Brown <hidden>
Date: 2021-03-05 22:21:33

On 2021-03-05 4:49 p.m., Junio C Hamano wrote:
This is totally expected behaviour.  In general when you are working
with plumbing commands like diff-files and diff-index, you are
expected to do "update-index --refresh" upfront.
Thanks. I wondered if since it was a plumbing command there might have
been something I was missing but didn't know where to look.

Cheers.

-- 
Michael Brown
Civilized Discourse Construction Kit, Inc.
https://www.discourse.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help