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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> 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@xxxxxx>
> ---
>
> 	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.

One solution would be to add a "const char *stdin_data" to diffopts
and read the data from stdin when you parse the options, and
have populate_filespec point at that with s->data (setting
should_free and should_munmap both to 0).

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]