sha1_file_name(): overwrite buffer instead of appending
commitb69fb867b4bb9e30e705d2176fe8a0a90b208325
authorJeff King <peff@peff.net>
Mon, 12 Nov 2018 14:48:56 +0000 (12 09:48 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Nov 2018 05:22:02 +0000 (13 14:22 +0900)
tree01342d6ba391110abde7d5907d6bb319e6944778
parent263db403face43927c2eb545a2e6ebb39aae4239
sha1_file_name(): overwrite buffer instead of appending

The sha1_file_name() function is used to generate the path to a loose
object in the object directory. It doesn't make much sense for it to
append, since the the path we write may be absolute (i.e., you cannot
reliably build up a path with it). Because many callers use it with a
static buffer, they have to strbuf_reset() manually before each call
(and the other callers always use an empty buffer, so they don't care
either way). Let's handle this automatically.

Since we're changing the semantics, let's take the opportunity to give
it a more hash-neutral name (which will also catch any callers from
topics in flight).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-walker.c
http.c
object-store.h
sha1-file.c