Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-07 Thread Christian Couder
On Thu, Nov 7, 2013 at 1:12 AM, Junio C Hamano wrote: > Jonathan Nieder writes: > >>> The old name followed the pattern anything-cmp(), which suggests >>> a general comparison function suitable for e.g. sorting objects. >>> But this was not the case for suffixcmp(). >> >> It's not clear to me tha

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Junio C Hamano
Jonathan Nieder writes: >> The old name followed the pattern anything-cmp(), which suggests >> a general comparison function suitable for e.g. sorting objects. >> But this was not the case for suffixcmp(). > > It's not clear to me that prefixcmp() is usable for sorting objects, > either. Shouldn

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Max Horn
> Am 07.11.2013 um 00:28 schrieb Jonathan Nieder : > > Max Horn wrote: > >> Well, unlike suffixcmp, it is transitive, so it could be used for sorting. > > It is not antisymmetric. > >prefixcmp("foo", "foobar") < 0 >prefixcmp("foobar", "foo") == 0 Right! I wasn't thinkinh :-( > > I c

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Jonathan Nieder
Max Horn wrote: > Well, unlike suffixcmp, it is transitive, so it could be used for sorting. It is not antisymmetric. prefixcmp("foo", "foobar") < 0 prefixcmp("foobar", "foo") == 0 I can see how it's possible to care about the sign of the return value, but it's equally possible

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Max Horn
On 06.11.2013, at 23:17, Jonathan Nieder wrote: > Hi, > > Christian Couder wrote: > >> Now has_suffix() returns 1 when the suffix is present and 0 otherwise. > > Ok. My only worry is that the function is less discoverable since > its name is so different from prefixcmp(), which might cause s

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Jonathan Nieder
Hi, Christian Couder wrote: > Now has_suffix() returns 1 when the suffix is present and 0 otherwise. Ok. My only worry is that the function is less discoverable since its name is so different from prefixcmp(), which might cause someone to invent yet another postfixcmp. > The old name followed

[PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-05 Thread Christian Couder
Now has_suffix() returns 1 when the suffix is present and 0 otherwise. The old name followed the pattern anything-cmp(), which suggests a general comparison function suitable for e.g. sorting objects. But this was not the case for suffixcmp(). Signed-off-by: Christian Couder --- builtin/clone.c