Re: [PATCH 2/2] Allow passing pipes for input pipes to diff --no-index
- From
Jeff King <peff@peff.net>
- Date
- Sep 18, 2020, 18:05 UTC
- Message-ID
- <20200918180508.GB186717@coredump.intra.peff.net>
- In-Reply-To
- <20200918175836.GA149847@nand.local>
On Fri, Sep 18, 2020 at 01:58:36PM -0400, Taylor Blau wrote:
Show 10 quoted lines
> > *untested*:
> >
> > if (!lstat(name, &st)) {
> > if (!S_ISLNK(st.st_mode))
> > return(0);
> > if (!stat(name, &st)) {
> > if (!S_ISFIFO(st.st_mode))
> > return(0);
>
> I still don't think I quite understand why FIFOs aren't allowed...It's the other way around. Non-fifos return "0" from this "is it a pipe" function.
I think it is to prevent a false positive with:
rm bar ln -s foo bar git diff --no-index foo something-else
We'd still want to treat "foo" as a symlink there. I.e., the heuristic for guessing it's a process substitution pipe is:
- it's a symlink that doesn't point anywhere - it's also a fifo
-Peff