Subject: Re: [PATCH v4 2/3] diff: Let "git diff -O" read orderfile from any file, fail properly

From: Junio C Hamano <[email-masked]>
Date: Tue, 17 Dec 2013 15:11:29 -0800

Antoine Pelisse <[email-masked]> writes:

> I'm not sure about the deadlock though. Both read and write will wait
> for each other to start operating on the fifo.

It is true only if the fifo already exists.  That is, if you did
this:

	a lot of &&
        commands &&
        before &&
        mkfifo fifo &&
        feed >fifo &

	git diff -Ofifo
        
the consumer may attempt to open and read fifo when the other
process is still running a lot of commands, no?

>
> You can probably fix the &&-chain by doing something like:
>
>     mkfifo order_fifo && {
>         cat order_file_$i >order_fifo &
>         git diff -O order_fifo --name-only HEAD^..HEAD >actual
>     } && ...
>
> Also, "rm -f order_fifo" should probably be done in test_when_finished
> rather than at the beginning of the test.
>
> Antoine,