aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-08-18 15:20:16 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-23 15:12:06 -0700
commit4f39cd821d1756f5f6d145f987576660136931ee (patch)
treec7a0b1de6a17b1336f82bbbd598d766e6d0030e3 /sha1_file.c
parent39566494226919aa18951f2abff6491f5547d377 (diff)
downloadgit-4f39cd821d1756f5f6d145f987576660136931ee.tar.gz
git-4f39cd821d1756f5f6d145f987576660136931ee.tar.xz
pack: move pack name-related functions
Currently, sha1_file.c and cache.h contain many functions, both related to and unrelated to packfiles. This makes both files very large and causes an unclear separation of concerns. Create a new file, packfile.c, to hold all packfile-related functions currently in sha1_file.c. It has a corresponding header packfile.h. In this commit, the pack name-related functions are moved. Subsequent commits will move the other functions. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 189a1c3cd..063409fe0 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -28,6 +28,7 @@
#include "list.h"
#include "mergesort.h"
#include "quote.h"
+#include "packfile.h"
#define SZ_FMT PRIuMAX
static inline uintmax_t sz_fmt(size_t s) { return s; }
@@ -278,28 +279,6 @@ static const char *alt_sha1_path(struct alternate_object_database *alt,
return buf->buf;
}
- 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), ext);
- return buf->buf;
-}
-
-char *sha1_pack_name(const unsigned char *sha1)
-{
- static struct strbuf buf = STRBUF_INIT;
- return odb_pack_name(&buf, sha1, "pack");
-}
-
-char *sha1_pack_index_name(const unsigned char *sha1)
-{
- static struct strbuf buf = STRBUF_INIT;
- return odb_pack_name(&buf, sha1, "idx");
-}
-
struct alternate_object_database *alt_odb_list;
static struct alternate_object_database **alt_odb_tail;