As sha1_file_name() could be performance sensitive, let's make it faster by using strbuf_addstr() and strbuf_addc() instead of strbuf_addf(). Helped-by: Derrick Stolee <stolee@xxxxxxxxx> Helped-by: Jeff Hostetler <git@xxxxxxxxxxxxxxxxx> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> --- sha1_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) So compared to v2 I just removed the call to strbuf_grow() and the related computation. diff --git a/sha1_file.c b/sha1_file.c index f66c21b2da..4f7f17a24c 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -323,8 +323,8 @@ static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1) void sha1_file_name(struct strbuf *buf, const unsigned char *sha1) { - strbuf_addf(buf, "%s/", get_object_directory()); - + strbuf_addstr(buf, get_object_directory()); + strbuf_addch(buf, '/'); fill_sha1_path(buf, sha1); } -- 2.16.0.rc2.3.g7330290b09