summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Stefan Beller <sbeller@google.com>2018-03-23 18:20:57 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-03-23 11:06:01 -0700
commit031dc927f443fa5274e794c12ac34f19a0e0d318 (patch)
tree07acd9769fb07037595e1ac0643984f43c8b3641 /builtin
parentobject-store: migrate alternates struct and functions from cache.h (diff)
downloadtgif-031dc927f443fa5274e794c12ac34f19a0e0d318.tar.xz
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 'builtin')
-rw-r--r--builtin/fsck.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index b0eba4c3c9..c736a10a11 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "cache.h"
+#include "repository.h"
#include "config.h"
#include "commit.h"
#include "tree.h"
@@ -714,9 +715,12 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
for_each_loose_object(mark_loose_for_connectivity, NULL, 0);
for_each_packed_object(mark_packed_for_connectivity, NULL, 0);
} else {
+ struct alternate_object_database *alt_odb_list;
+
fsck_object_dir(get_object_directory());
prepare_alt_odb();
+ alt_odb_list = the_repository->objects->alt_odb_list;
for (alt = alt_odb_list; alt; alt = alt->next)
fsck_object_dir(alt->path);