pack: move pack name-related functions
[git/git.git] / packfile.c
CommitLineData
4f39cd82
JT
1#include "cache.h"
2
3char *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
13char *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
19char *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}