Re: [PATCH 1/2] sha1_name: stop hard-coding 40-character hex checks

2013-06-18 Thread Junio C Hamano
Ramkumar Ramachandra writes: > Phil Hord wrote: >> I share your disdain for the bare '40's in the code. But I think this >> code is less clear than the previous version with the magic number. > > Please read the cover-letter: Which was... >> [1/2] is important. [2/2] is a minor prettificatio

Re: [PATCH 1/2] sha1_name: stop hard-coding 40-character hex checks

2013-06-18 Thread Ramkumar Ramachandra
Phil Hord wrote: > I share your disdain for the bare '40's in the code. But I think this > code is less clear than the previous version with the magic number. Please read the cover-letter: I was just toying around to see if this was a good idea, and Junio points out that it's not. -- To unsubscri

Re: [PATCH 1/2] sha1_name: stop hard-coding 40-character hex checks

2013-06-16 Thread Phil Hord
On Sat, Jun 15, 2013 at 1:38 PM, Ramkumar Ramachandra wrote: > In two places, get_sha1_basic() assumes that strings are possibly sha1 > hexes if they are 40 characters long, and calls get_sha1_hex() in these > two cases. This 40-character check is ugly and wrong: there is nothing > preventing a r

[PATCH 1/2] sha1_name: stop hard-coding 40-character hex checks

2013-06-15 Thread Ramkumar Ramachandra
In two places, get_sha1_basic() assumes that strings are possibly sha1 hexes if they are 40 characters long, and calls get_sha1_hex() in these two cases. This 40-character check is ugly and wrong: there is nothing preventing a revision or branch name from being exactly 40 characters. Replace it wi