Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-08 Thread Philip Oakley
From: Jeff King p...@peff.net Sent: Sunday, September 08, 2013 5:06 AM Was there some objective argument made that I missed? Here's more; human semantics: Isn't this one of those pick any two from three tasks: 'human', 'objective', 'argument'. Only 1/6 of the time is an 'objective'

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-08 Thread Junio C Hamano
Jeff King p...@peff.net writes: A(ny) sanely defined compare A with B function should yield the result of subtracting B from A, i.e. cmp(A,B) should be like (A-B). That is what you feed qsort() and bsearch() (it is not limited to C; you see the same in sort { $a = $b }). The definition

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-08 Thread Felipe Contreras
On Sun, Sep 8, 2013 at 1:33 PM, Junio C Hamano gits...@pobox.com wrote: Jeff King p...@peff.net writes: Calling the abstraction test_diff might have avoided the wasted brain bandwidth in this thread, but I do not think renaming it in test-lib-functions.sh is worth the trouble, either ;-)

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-08 Thread Felipe Contreras
On Sun, Sep 8, 2013 at 12:02 AM, Jeff King p...@peff.net wrote: On Sat, Sep 07, 2013 at 11:52:10PM -0500, Felipe Contreras wrote: Ah, you mean if you think that the compare function should behave like C *_cmp functions, it should be A-B. Perhaps it is simply that I do not think of the

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-08 Thread Jeff King
On Sun, Sep 08, 2013 at 06:25:45PM -0500, Felipe Contreras wrote: And I do not think it is a problem. The point of the function is not to abstract away the idea of comparison. The point is to give a hook for people on systems without diff -u to run the test suite. The point according to

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-08 Thread Felipe Contreras
On Sun, Sep 8, 2013 at 6:45 PM, Jeff King p...@peff.net wrote: On Sun, Sep 08, 2013 at 06:25:45PM -0500, Felipe Contreras wrote: And I do not think it is a problem. The point of the function is not to abstract away the idea of comparison. The point is to give a hook for people on systems

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Felipe Contreras
On Wed, Sep 4, 2013 at 1:36 PM, Jeff King p...@peff.net wrote: On Wed, Sep 04, 2013 at 10:38:03AM -0700, Junio C Hamano wrote: This is way off tangent, but I am somewhat sympathetic to Felipe's compare actual with expect, with reservations. This isn't an argument either way, but note

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Jeff King
On Sat, Sep 07, 2013 at 10:11:49PM -0500, Felipe Contreras wrote: Though I prefer the current, I can certainly live and adapt to a changed standard, and I do not mind doing so if there is a good reason. But I've yet to see any argument beyond it is not what I like. Which to me argues for

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Felipe Contreras
On Sat, Sep 7, 2013 at 11:06 PM, Jeff King p...@peff.net wrote: On Sat, Sep 07, 2013 at 10:11:49PM -0500, Felipe Contreras wrote: Though I prefer the current, I can certainly live and adapt to a changed standard, and I do not mind doing so if there is a good reason. But I've yet to see any

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Felipe Contreras
On Sat, Sep 7, 2013 at 11:13 PM, Felipe Contreras felipe.contre...@gmail.com wrote: On Sat, Sep 7, 2013 at 11:06 PM, Jeff King p...@peff.net wrote: On Sat, Sep 07, 2013 at 10:11:49PM -0500, Felipe Contreras wrote: Though I prefer the current, I can certainly live and adapt to a changed

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Jeff King
On Sat, Sep 07, 2013 at 11:13:10PM -0500, Felipe Contreras wrote: If the reasoning is cmp(actual, expect) makes more sense to humans then I do not think it is universal. No. --- A(ny) sanely defined compare A with B function should yield the result of subtracting B from A, i.e.

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Felipe Contreras
On Sat, Sep 7, 2013 at 11:26 PM, Jeff King p...@peff.net wrote: On Sat, Sep 07, 2013 at 11:13:10PM -0500, Felipe Contreras wrote: If the reasoning is cmp(actual, expect) makes more sense to humans then I do not think it is universal. No. --- A(ny) sanely defined compare A with B

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-07 Thread Jeff King
On Sat, Sep 07, 2013 at 11:52:10PM -0500, Felipe Contreras wrote: Ah, you mean if you think that the compare function should behave like C *_cmp functions, it should be A-B. Perhaps it is simply that I do not think of the function in those terms, but more like show me the differences from

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-04 Thread John Keeping
On Wed, Sep 04, 2013 at 09:47:12AM -0700, Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: test_cmp_rev follows the same order of arguments a diff -u and produces the same output as plain git diff. It's perfectly readable and normal. This is way off tangent, but I am

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-04 Thread Junio C Hamano
John Keeping j...@keeping.me.uk writes: On Wed, Sep 04, 2013 at 09:47:12AM -0700, Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: test_cmp_rev follows the same order of arguments a diff -u and produces the same output as plain git diff. It's perfectly readable and

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-04 Thread Jeff King
On Wed, Sep 04, 2013 at 10:38:03AM -0700, Junio C Hamano wrote: This is way off tangent, but I am somewhat sympathetic to Felipe's compare actual with expect, with reservations. This isn't an argument either way, but note that JUnit (and NUnit and PHPUnit) all have assertEquals methods

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-04 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Wed, Sep 04, 2013 at 10:38:03AM -0700, Junio C Hamano wrote: This is way off tangent, but I am somewhat sympathetic to Felipe's compare actual with expect, with reservations. This isn't an argument either way, but note that JUnit (and NUnit and

[PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-03 Thread Jonathan Nieder
SZEDER Gábor wrote: On Tue, Sep 03, 2013 at 08:39:54AM -0500, Felipe Contreras wrote: There are two ways to fix an inconsistency, the other way is to fix test_cmp. But that would be a change, and change is not welcome in Git. It depends on the change, I suppose. I agree, changing 3k+ lines

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-03 Thread Jeff King
On Tue, Sep 03, 2013 at 10:04:19AM -0700, Jonathan Nieder wrote: It depends on the change, I suppose. I agree, changing 3k+ lines just to avoid yoda conditions... I doubt the gain worth the code churn. Especially when the idiom being changed is not even being made better. ;-) Yes. IMHO

Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

2013-09-03 Thread Felipe Contreras
On Tue, Sep 3, 2013 at 12:04 PM, Jonathan Nieder jrnie...@gmail.com wrote: SZEDER Gábor wrote: On Tue, Sep 03, 2013 at 08:39:54AM -0500, Felipe Contreras wrote: There are two ways to fix an inconsistency, the other way is to fix test_cmp. But that would be a change, and change is not welcome