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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 25, 2007, 23:11 UTC
Message-ID
<Pine.LNX.4.63.0702260009530.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vvehprgl7.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sun, 25 Feb 2007, Junio C Hamano wrote:
Show 20 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > 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 <johannes.schindelin@gmx.de>
> > ---
> >
> > 	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

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “diff: support reading a file from stdin via "-"”
  1. 4/8 diff: support reading a file from stdin via "-"Johannes Schindelin, Feb 25, 2007
  2. Junio C HamanoFeb 25, 2007
  3. Johannes SchindelinFeb 25, 2007
  4. Junio C HamanoFeb 25, 2007
  5. Junio C HamanoFeb 26, 2007
  6. Johannes SchindelinFeb 26, 2007

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.