object-store: close all packs upon clearing the object store
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a80d72db2a
commit
d0b5986622
@ -1859,7 +1859,7 @@ next:
|
|||||||
*/
|
*/
|
||||||
if (!state->rebasing) {
|
if (!state->rebasing) {
|
||||||
am_destroy(state);
|
am_destroy(state);
|
||||||
close_all_packs();
|
close_all_packs(the_repository->objects);
|
||||||
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
|
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1218,7 +1218,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
transport_disconnect(transport);
|
transport_disconnect(transport);
|
||||||
|
|
||||||
if (option_dissociate) {
|
if (option_dissociate) {
|
||||||
close_all_packs();
|
close_all_packs(the_repository->objects);
|
||||||
dissociate_from_references();
|
dissociate_from_references();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1478,7 +1478,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
string_list_clear(&list, 0);
|
string_list_clear(&list, 0);
|
||||||
|
|
||||||
close_all_packs();
|
close_all_packs(the_repository->objects);
|
||||||
|
|
||||||
argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
|
argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
|
||||||
if (verbosity < 0)
|
if (verbosity < 0)
|
||||||
|
@ -411,7 +411,7 @@ static void finish(struct commit *head_commit,
|
|||||||
* We ignore errors in 'gc --auto', since the
|
* We ignore errors in 'gc --auto', since the
|
||||||
* user should see them.
|
* user should see them.
|
||||||
*/
|
*/
|
||||||
close_all_packs();
|
close_all_packs(the_repository->objects);
|
||||||
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
|
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2026,7 +2026,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
|
|||||||
proc.git_cmd = 1;
|
proc.git_cmd = 1;
|
||||||
proc.argv = argv_gc_auto;
|
proc.argv = argv_gc_auto;
|
||||||
|
|
||||||
close_all_packs();
|
close_all_packs(the_repository->objects);
|
||||||
if (!start_command(&proc)) {
|
if (!start_command(&proc)) {
|
||||||
if (use_sideband)
|
if (use_sideband)
|
||||||
copy_to_sideband(proc.err, -1, NULL);
|
copy_to_sideband(proc.err, -1, NULL);
|
||||||
|
7
object.c
7
object.c
@ -5,6 +5,7 @@
|
|||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "packfile.h"
|
||||||
|
|
||||||
static struct object **obj_hash;
|
static struct object **obj_hash;
|
||||||
static int nr_objs, obj_hash_size;
|
static int nr_objs, obj_hash_size;
|
||||||
@ -483,8 +484,6 @@ void raw_object_store_clear(struct raw_object_store *o)
|
|||||||
o->alt_odb_tail = NULL;
|
o->alt_odb_tail = NULL;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&o->packed_git_mru);
|
INIT_LIST_HEAD(&o->packed_git_mru);
|
||||||
/*
|
close_all_packs(o);
|
||||||
* TODO: call close_all_packs once migrated to
|
o->packed_git = NULL;
|
||||||
* take an object store argument
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -311,11 +311,11 @@ static void close_pack(struct packed_git *p)
|
|||||||
close_pack_index(p);
|
close_pack_index(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_all_packs(void)
|
void close_all_packs(struct raw_object_store *o)
|
||||||
{
|
{
|
||||||
struct packed_git *p;
|
struct packed_git *p;
|
||||||
|
|
||||||
for (p = the_repository->objects->packed_git; p; p = p->next)
|
for (p = o->packed_git; p; p = p->next)
|
||||||
if (p->do_not_close)
|
if (p->do_not_close)
|
||||||
die("BUG: want to close pack marked 'do-not-close'");
|
die("BUG: want to close pack marked 'do-not-close'");
|
||||||
else
|
else
|
||||||
|
@ -66,7 +66,7 @@ extern void close_pack_index(struct packed_git *);
|
|||||||
|
|
||||||
extern unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned long *);
|
extern unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned long *);
|
||||||
extern void close_pack_windows(struct packed_git *);
|
extern void close_pack_windows(struct packed_git *);
|
||||||
extern void close_all_packs(void);
|
extern void close_all_packs(struct raw_object_store *o);
|
||||||
extern void unuse_pack(struct pack_window **);
|
extern void unuse_pack(struct pack_window **);
|
||||||
extern void clear_delta_base_cache(void);
|
extern void clear_delta_base_cache(void);
|
||||||
extern struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
|
extern struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
|
||||||
|
Reference in New Issue
Block a user