Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 4/8] diff: support reading a file from stdin via "-"

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:56

Hi,

On Sun, 25 Feb 2007, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
This allows you to say

	echo Hello World | git diff x -

to compare the contents of file "x" with the line "Hello World".
This automatically switches to --no-index mode.

Signed-off-by: Johannes Schindelin <redacted>
---

	Since the revision machinery checks for the presence of files,
	diff_populate_filespec() will only change behaviour when there
	is a file "-"... I have yet to think of an elegant fix for that.
Another thing is that at some point diff_populate_filespec()
needs to have a way to discard what was cached if memory
pressure gets tight, and we would want to keep this data read
from the standard input.
I see this purely for purposes of --no-index diff. And in that case, we 
only compare one file pair. Either one of them is from stdin, or it is 
not. Therefore, if memory gets tight, we cannot compare that file pair 
anyway, and have to error out.

Maybe I missed something obvious?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help