path: root/sha1_name.c
diff options
authorStefan Beller <>2018-03-23 17:20:57 (GMT)
committerJunio C Hamano <>2018-03-23 18:06:01 (GMT)
commit031dc927f443fa5274e794c12ac34f19a0e0d318 (patch)
tree07acd9769fb07037595e1ac0643984f43c8b3641 /sha1_name.c
parent0d4a132144a14ae6801523960cbc1939a9bab6c1 (diff)
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 <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'sha1_name.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 434025b..a22a29c 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -11,6 +11,7 @@
#include "sha1-array.h"
#include "packfile.h"
#include "object-store.h"
+#include "repository.h"
static int get_oid_oneline(const char *, struct object_id *, struct commit_list *);
@@ -105,7 +106,7 @@ static void find_short_object_filename(struct disambiguate_state *ds)
fakeent = alloc_alt_odb(get_object_directory());
- fakeent->next = alt_odb_list;
+ fakeent->next = the_repository->objects->alt_odb_list;
for (alt = fakeent; alt && !ds->ambiguous; alt = alt->next) {
int pos;