summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-21 22:07:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-21 22:07:17 (GMT)
commit45cbc37c5f84fadd78cccf6b2ea82a9ef251cdc6 (patch)
tree279382ccc172caff7ccd76eb2f0743619063597f /cache.h
parente15b9606557d590e1cdc1e3b1b9154cce455a4c8 (diff)
parentf20754802a280c57a1e5886605b6805bbf040c63 (diff)
downloadgit-45cbc37c5f84fadd78cccf6b2ea82a9ef251cdc6.zip
git-45cbc37c5f84fadd78cccf6b2ea82a9ef251cdc6.tar.gz
git-45cbc37c5f84fadd78cccf6b2ea82a9ef251cdc6.tar.bz2
Merge branch 'jk/pack-name-cleanups'
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 'cache.h')
-rw-r--r--cache.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 9b2157f..14f8a06 100644
--- a/cache.h
+++ b/cache.h
@@ -1654,6 +1654,27 @@ extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
extern void pack_report(void);
/*
+ * Create a temporary file rooted in the object database directory.
+ */
+extern int odb_mkstemp(char *template, size_t limit, const char *pattern);
+
+/*
+ * Generate the filename to be used for a pack file with checksum "sha1" and
+ * extension "ext". The result is written into the strbuf "buf", overwriting
+ * any existing contents. A pointer to buf->buf is returned as a convenience.
+ *
+ * Example: odb_pack_name(out, sha1, "idx") => ".git/objects/pack/pack-1234..idx"
+ */
+extern char *odb_pack_name(struct strbuf *buf, const unsigned char *sha1, const char *ext);
+
+/*
+ * Create a pack .keep file named "name" (which should generally be the output
+ * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on
+ * error.
+ */
+extern int odb_pack_keep(const char *name);
+
+/*
* mmap the index file for the specified packfile (if it is not
* already mmapped). Return 0 on success.
*/