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

2013-12-17 Thread Junio C Hamano
Samuel Bronson writes: > On Tue, Dec 17, 2013 at 5:09 PM, Junio C Hamano wrote: >> My point was that I did not see much value in reading the orderfile >> data from anything but a file. At that point, you are not testing >> the "diff -O" orderfile option, but if strbuf_readline() reads from >> a

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

2013-12-17 Thread Samuel Bronson
On Tue, Dec 17, 2013 at 5:09 PM, Junio C Hamano wrote: > My point was that I did not see much value in reading the orderfile > data from anything but a file. At that point, you are not testing > the "diff -O" orderfile option, but if strbuf_readline() reads from > a non-regular file. Oh, good po

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

2013-12-17 Thread Junio C Hamano
Antoine Pelisse 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 &

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

2013-12-17 Thread Junio C Hamano
Antoine Pelisse writes: >> How about not doing a fifo? > > That would certainly defeat the purpose of the test, which is to test > against a fifo :-) My point was that I did not see much value in reading the orderfile data from anything but a file. At that point, you are not testing the "diff -

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

2013-12-17 Thread Antoine Pelisse
On Tue, Dec 17, 2013 at 6:54 PM, Junio C Hamano wrote: > Samuel Bronson writes: > >> On Mon, Dec 16, 2013 at 4:32 PM, Junio C Hamano wrote: >>> Samuel Bronson writes: >>> for i in 1 2 do test_expect_success "orderfile using option ($i)" ' git diff -Oorder_file_

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

2013-12-17 Thread Junio C Hamano
Samuel Bronson writes: > On Mon, Dec 16, 2013 at 4:32 PM, Junio C Hamano wrote: >> Samuel Bronson writes: >> >>> for i in 1 2 >>> do >>> test_expect_success "orderfile using option ($i)" ' >>> git diff -Oorder_file_$i --name-only HEAD^..HEAD >actual && >>> test_cmp expect_$i

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

2013-12-16 Thread Samuel Bronson
On Mon, Dec 16, 2013 at 4:32 PM, Junio C Hamano wrote: > Samuel Bronson writes: > >> for i in 1 2 >> do >> test_expect_success "orderfile using option ($i)" ' >> git diff -Oorder_file_$i --name-only HEAD^..HEAD >actual && >> test_cmp expect_$i actual >> ' > > This funny inden

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

2013-12-16 Thread Samuel Bronson
On Mon, Dec 16, 2013 at 4:09 PM, Junio C Hamano wrote: > Samuel Bronson writes: >> +test_expect_success 'unreadable orderfile' ' >> + touch unreadable_file && >> + chmod -r unreadable_file && > - this test probably needs restricted to people with sane > filesystems; I think POSIXP

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

2013-12-16 Thread Junio C Hamano
Samuel Bronson writes: > for i in 1 2 > do > test_expect_success "orderfile using option ($i)" ' > git diff -Oorder_file_$i --name-only HEAD^..HEAD >actual && > test_cmp expect_$i actual > ' This funny indentation in the previous step needs to be fixed, and the added block b

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

2013-12-16 Thread Junio C Hamano
Samuel Bronson writes: > diff --git a/t/t4056-diff-order.sh b/t/t4056-diff-order.sh > index 398b3f6..eb471e7 100755 > --- a/t/t4056-diff-order.sh > +++ b/t/t4056-diff-order.sh > @@ -61,12 +61,35 @@ test_expect_success "no order (=tree object order)" ' > test_cmp expect_none actual > ' >

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

2013-12-16 Thread Samuel Bronson
The -O flag really shouldn't silently fail to do anything when given a path that it can't read from. However, it should be able to read from un-mmappable files, such as: * pipes/fifos * /dev/null: It's a character device (at least on Linux) * ANY empty file: Quoting Linux mmap(2), "SUSv