diff options
author | Jeff King <peff@peff.net> | 2017-03-28 15:45:52 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-28 15:28:04 -0700 |
commit | 4aa7d75e48250026fce9b496cb5405c269331c31 (patch) | |
tree | 0203ee654b72bedbee5efba8aba8a662a545f991 /environment.c | |
parent | 594fa9998c41277c579a94657100fa303160aa7e (diff) | |
download | git-4aa7d75e48250026fce9b496cb5405c269331c31.tar.gz |
odb_mkstemp: use git_path_buf
Since git_path_buf() is smart enough to replace "objects/"
with the correct object path, we can use it instead of
manually assembling the path. That's slightly shorter, and
will clean up any non-canonical bits in the path.
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/environment.c b/environment.c index 88276790db..a9bf5658ad 100644 --- a/environment.c +++ b/environment.c @@ -282,16 +282,14 @@ int odb_mkstemp(struct strbuf *template, const char *pattern) * restrictive except to remove write permission. */ int mode = 0444; - strbuf_reset(template); - strbuf_addf(template, "%s/%s", get_object_directory(), pattern); + git_path_buf(template, "objects/%s", pattern); fd = git_mkstemp_mode(template->buf, mode); if (0 <= fd) return fd; /* slow path */ /* some mkstemp implementations erase template on failure */ - strbuf_reset(template); - strbuf_addf(template, "%s/%s", get_object_directory(), pattern); + git_path_buf(template, "objects/%s", pattern); safe_create_leading_directories(template->buf); return xmkstemp_mode(template->buf, mode); } |