Browse Source

Merge branch 'sb/object-store-replace'

Hotfix.

* sb/object-store-replace:
  get_main_ref_store: BUG() when outside a repository
  object.c: clear replace map before freeing it
  replace-object.c: remove the_repository from prepare_replace_object
  object.c: free replace map in raw_object_store_clear
maint
Junio C Hamano 7 years ago
parent
commit
a2cec42213
  1. 3
      object.c
  2. 3
      refs.c
  3. 2
      replace-object.c

3
object.c

@ -481,6 +481,9 @@ void raw_object_store_clear(struct raw_object_store *o) @@ -481,6 +481,9 @@ void raw_object_store_clear(struct raw_object_store *o)
FREE_AND_NULL(o->objectdir);
FREE_AND_NULL(o->alternate_db);

oidmap_free(o->replace_map, 1);
FREE_AND_NULL(o->replace_map);

free_alt_odbs(o);
o->alt_odb_tail = NULL;


3
refs.c

@ -1668,6 +1668,9 @@ struct ref_store *get_main_ref_store(struct repository *r) @@ -1668,6 +1668,9 @@ struct ref_store *get_main_ref_store(struct repository *r)
if (r->refs)
return r->refs;

if (!r->gitdir)
BUG("attempting to get main_ref_store outside of repository");

r->refs = ref_store_init(r->gitdir, REF_STORE_ALL_CAPS);
return r->refs;
}

2
replace-object.c

@ -37,7 +37,7 @@ static void prepare_replace_object(struct repository *r) @@ -37,7 +37,7 @@ static void prepare_replace_object(struct repository *r)
return;

r->objects->replace_map =
xmalloc(sizeof(*the_repository->objects->replace_map));
xmalloc(sizeof(*r->objects->replace_map));
oidmap_init(r->objects->replace_map, 0);

for_each_replace_ref(r, register_replace_ref, NULL);

Loading…
Cancel
Save