0d191dfd608cf33602fd156c7ca1457c51953d53
[git/git.git] / packfile.c
1 #include "cache.h"
2
3 char *odb_pack_name(struct strbuf *buf,
4 const unsigned char *sha1,
5 const char *ext)
6 {
7 strbuf_reset(buf);
8 strbuf_addf(buf, "%s/pack/pack-%s.%s", get_object_directory(),
9 sha1_to_hex(sha1), ext);
10 return buf->buf;
11 }
12
13 char *sha1_pack_name(const unsigned char *sha1)
14 {
15 static struct strbuf buf = STRBUF_INIT;
16 return odb_pack_name(&buf, sha1, "pack");
17 }
18
19 char *sha1_pack_index_name(const unsigned char *sha1)
20 {
21 static struct strbuf buf = STRBUF_INIT;
22 return odb_pack_name(&buf, sha1, "idx");
23 }