summaryrefslogtreecommitdiff
path: root/object-store.h
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-03-23 17:20:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-23 18:06:01 (GMT)
commit031dc927f443fa5274e794c12ac34f19a0e0d318 (patch)
tree07acd9769fb07037595e1ac0643984f43c8b3641 /object-store.h
parent0d4a132144a14ae6801523960cbc1939a9bab6c1 (diff)
downloadgit-031dc927f443fa5274e794c12ac34f19a0e0d318.zip
git-031dc927f443fa5274e794c12ac34f19a0e0d318.tar.gz
git-031dc927f443fa5274e794c12ac34f19a0e0d318.tar.bz2
object-store: move alt_odb_list and alt_odb_tail to object store
In a process with multiple repositories open, alternates should be associated to a single repository and not shared globally. Move alt_odb_list and alt_odb_tail into the_repository and adjust callers to reflect this. Now that the alternative object data base is per repository, we're leaking its memory upon freeing a repository. The next patch plugs this hole. No functional change intended. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-store.h')
-rw-r--r--object-store.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/object-store.h b/object-store.h
index 5002e37..0b4db58 100644
--- a/object-store.h
+++ b/object-store.h
@@ -1,7 +1,7 @@
#ifndef OBJECT_STORE_H
#define OBJECT_STORE_H
-extern struct alternate_object_database {
+struct alternate_object_database {
struct alternate_object_database *next;
/* see alt_scratch_buf() */
@@ -19,7 +19,7 @@ extern struct alternate_object_database {
struct oid_array loose_objects_cache;
char path[FLEX_ARRAY];
-} *alt_odb_list;
+};
void prepare_alt_odb(void);
char *compute_alternate_path(const char *path, struct strbuf *err);
typedef int alt_odb_fn(struct alternate_object_database *, void *);
@@ -61,6 +61,9 @@ struct raw_object_store {
/* Path to extra alternate object database if not NULL */
char *alternate_db;
+
+ struct alternate_object_database *alt_odb_list;
+ struct alternate_object_database **alt_odb_tail;
};
struct raw_object_store *raw_object_store_new(void);