diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-28 22:52:25 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-28 22:52:25 +0200 |
commit | ba5e05ffeff03c4835d0618ab34acb97ef753d0c (patch) | |
tree | cebbf61ffff3b9556ba381bd8cdd61b71b81f962 /sha1_file.c | |
parent | Merge branch 'jk/rev-parse-cleanup' into maint (diff) | |
parent | index-pack: make pointer-alias fallbacks safer (diff) | |
download | git-ba5e05ffeff03c4835d0618ab34acb97ef753d0c.tar.xz git-ba5e05ffeff03c4835d0618ab34acb97ef753d0c.zip |
Merge branch 'jk/pack-name-cleanups' into maint
Code clean-up.
* jk/pack-name-cleanups:
index-pack: make pointer-alias fallbacks safer
replace snprintf with odb_pack_name()
odb_pack_keep(): stop generating keepfile name
sha1_file.c: make pack-name helper globally accessible
move odb_* declarations out of git-compat-util.h
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sha1_file.c b/sha1_file.c index 8ce80d4481..d77b915db6 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -203,31 +203,26 @@ static const char *alt_sha1_path(struct alternate_object_database *alt, return buf->buf; } -/* - * Return the name of the pack or index file with the specified sha1 - * in its filename. *base and *name are scratch space that must be - * provided by the caller. which should be "pack" or "idx". - */ -static char *sha1_get_pack_name(const unsigned char *sha1, - struct strbuf *buf, - const char *which) + char *odb_pack_name(struct strbuf *buf, + const unsigned char *sha1, + const char *ext) { strbuf_reset(buf); strbuf_addf(buf, "%s/pack/pack-%s.%s", get_object_directory(), - sha1_to_hex(sha1), which); + sha1_to_hex(sha1), ext); return buf->buf; } char *sha1_pack_name(const unsigned char *sha1) { static struct strbuf buf = STRBUF_INIT; - return sha1_get_pack_name(sha1, &buf, "pack"); + return odb_pack_name(&buf, sha1, "pack"); } char *sha1_pack_index_name(const unsigned char *sha1) { static struct strbuf buf = STRBUF_INIT; - return sha1_get_pack_name(sha1, &buf, "idx"); + return odb_pack_name(&buf, sha1, "idx"); } struct alternate_object_database *alt_odb_list; |