summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-10-03 20:35:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-10 20:52:36 (GMT)
commit7f0fa2c02a6543bdadae3c4a492daae7dbc8c042 (patch)
tree5fc856fb9a95e4e5edc2c5d2c980d14f984ce8a8 /cache.h
parenta5b34d21521c015cd41ced4a3fdde57d79891eb3 (diff)
downloadgit-7f0fa2c02a6543bdadae3c4a492daae7dbc8c042.zip
git-7f0fa2c02a6543bdadae3c4a492daae7dbc8c042.tar.gz
git-7f0fa2c02a6543bdadae3c4a492daae7dbc8c042.tar.bz2
alternates: provide helper for allocating alternate
Allocating a struct alternate_object_database is tricky, as we must over-allocate the buffer to provide scratch space, and then put in particular '/' and NUL markers. Let's encapsulate this in a function so that the complexity doesn't leak into callers (and so that we can modify it later). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 258ce6b..ece2c7c 100644
--- a/cache.h
+++ b/cache.h
@@ -1393,6 +1393,12 @@ typedef int alt_odb_fn(struct alternate_object_database *, void *);
extern int foreach_alt_odb(alt_odb_fn, void*);
/*
+ * Allocate a "struct alternate_object_database" but do _not_ actually
+ * add it to the list of alternates.
+ */
+struct alternate_object_database *alloc_alt_odb(const char *dir);
+
+/*
* Add the directory to the on-disk alternates file; the new entry will also
* take effect in the current process.
*/