Re: [PATCH] sha1_file: use strbuf_add() instead of strbuf_addf()

2017-12-01 Thread Jeff King
On Fri, Dec 01, 2017 at 02:50:05PM -0500, Derrick Stolee wrote: > > > + baselen = path->len; > > We set this here so that the '/' is included as part of the base. Makes > > sense, but can we now drop the earlier setting of baselen before the > > opendir() call? > > Yeah, probably. I had briefly

Re: [PATCH] sha1_file: use strbuf_add() instead of strbuf_addf()

2017-12-01 Thread Derrick Stolee
On 12/1/2017 1:22 PM, Jeff King wrote: On Fri, Dec 01, 2017 at 12:49:56PM -0500, Derrick Stolee wrote: [snip] diff --git a/sha1_file.c b/sha1_file.c index 8ae6cb6285..2160323c4a 100644 This overall looks good, but I noticed one bug and a few cosmetic improvements. Thanks for finding quality

Re: [PATCH] sha1_file: use strbuf_add() instead of strbuf_addf()

2017-12-01 Thread Jeff King
On Fri, Dec 01, 2017 at 12:49:56PM -0500, Derrick Stolee wrote: > Replace use of strbuf_addf() with strbuf_add() when enumerating > loose objects in for_each_file_in_obj_subdir(). Since we already > check the length and hex-values of the string before consuming > the path, we can prevent extra

[PATCH] sha1_file: use strbuf_add() instead of strbuf_addf()

2017-12-01 Thread Derrick Stolee
Replace use of strbuf_addf() with strbuf_add() when enumerating loose objects in for_each_file_in_obj_subdir(). Since we already check the length and hex-values of the string before consuming the path, we can prevent extra computation by using the lower- level method. One consumer of