Re: [PATCH v3 02/19] builtin/diff-tree: convert to struct object_id

2017-02-18 Thread Jeff King
On Sat, Feb 18, 2017 at 07:12:18PM +, brian m. carlson wrote: > On Fri, Feb 17, 2017 at 10:15:31PM -0500, Jeff King wrote: > > So for this case, something like the patch below. > > > > Incidentally, there's an off-by-one in the original loop of > > stdin_diff_commit that reads past the end

Re: [PATCH v3 02/19] builtin/diff-tree: convert to struct object_id

2017-02-18 Thread brian m. carlson
On Fri, Feb 17, 2017 at 10:15:31PM -0500, Jeff King wrote: > So for this case, something like the patch below. > > Incidentally, there's an off-by-one in the original loop of > stdin_diff_commit that reads past the end of the trailing NUL for the > final sha1 on the line. The problem is the: > >

Re: [PATCH v3 02/19] builtin/diff-tree: convert to struct object_id

2017-02-17 Thread Jeff King
On Fri, Feb 17, 2017 at 08:42:17PM -0500, Jeff King wrote: > > I'm wondering if parse_oid_hex could be useful here as well. > > I know I haven't looked at this chunk nearly as carefully as you have, > but it seems somewhat crazy to me that these functions get the original > "line" in the first

Re: [PATCH v3 02/19] builtin/diff-tree: convert to struct object_id

2017-02-17 Thread Jeff King
On Sat, Feb 18, 2017 at 01:26:07AM +, brian m. carlson wrote: > > > + struct object_id oid; > > > struct tree *tree2; > > > - if (len != 82 || !isspace(line[40]) || get_sha1_hex(line + 41, sha1)) > > > + const int chunksz = GIT_SHA1_HEXSZ + 1; > > > + if (len != 2 * chunksz ||

Re: [PATCH v3 02/19] builtin/diff-tree: convert to struct object_id

2017-02-17 Thread brian m. carlson
On Sat, Feb 18, 2017 at 01:18:11AM +, Ramsay Jones wrote: > > > On 18/02/17 00:06, brian m. carlson wrote: > > Convert most leaf functions to struct object_id. Rewrite several > > hardcoded numbers in terms of GIT_SHA1_HEXSZ, using an intermediate > > variable where that makes sense. > > >

Re: [PATCH v3 02/19] builtin/diff-tree: convert to struct object_id

2017-02-17 Thread Ramsay Jones
On 18/02/17 00:06, brian m. carlson wrote: > Convert most leaf functions to struct object_id. Rewrite several > hardcoded numbers in terms of GIT_SHA1_HEXSZ, using an intermediate > variable where that makes sense. > > Signed-off-by: brian m. carlson > --- >