Skip to content

Commit 5cb7c73

Browse files
committed
Merge branch 'ds/close-object-store'
The commit-graph file is now part of the "files that the runtime may keep open file descriptors on, all of which would need to be closed when done with the object store", and the file descriptor to an existing commit-graph file now is closed before "gc" finalizes a new instance to replace it. * ds/close-object-store: packfile: rename close_all_packs to close_object_store packfile: close commit-graph in close_all_packs commit-graph: use raw_object_store when closing
2 parents e116894 + 2d511cf commit 5cb7c73

File tree

14 files changed

+21
-18
lines changed

14 files changed

+21
-18
lines changed

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ static void am_run(struct am_state *state, int resume)
18011801
*/
18021802
if (!state->rebasing) {
18031803
am_destroy(state);
1804-
close_all_packs(the_repository->objects);
1804+
close_object_store(the_repository->objects);
18051805
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
18061806
}
18071807
}

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
12521252
transport_disconnect(transport);
12531253

12541254
if (option_dissociate) {
1255-
close_all_packs(the_repository->objects);
1255+
close_object_store(the_repository->objects);
12561256
dissociate_from_references();
12571257
}
12581258

builtin/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
16801680

16811681
string_list_clear(&list, 0);
16821682

1683-
close_all_packs(the_repository->objects);
1683+
close_object_store(the_repository->objects);
16841684

16851685
argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
16861686
if (verbosity < 0)

builtin/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
653653
gc_before_repack();
654654

655655
if (!repository_format_precious_objects) {
656-
close_all_packs(the_repository->objects);
656+
close_object_store(the_repository->objects);
657657
if (run_command_v_opt(repack.argv, RUN_GIT_CMD))
658658
die(FAILED_RUN, repack.argv[0]);
659659

@@ -681,7 +681,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
681681
report_garbage = report_pack_garbage;
682682
reprepare_packed_git(the_repository);
683683
if (pack_garbage.nr > 0) {
684-
close_all_packs(the_repository->objects);
684+
close_object_store(the_repository->objects);
685685
clean_pack_garbage();
686686
}
687687

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static void finish(struct commit *head_commit,
453453
* We ignore errors in 'gc --auto', since the
454454
* user should see them.
455455
*/
456-
close_all_packs(the_repository->objects);
456+
close_object_store(the_repository->objects);
457457
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
458458
}
459459
}

builtin/rebase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static int finish_rebase(struct rebase_options *opts)
741741

742742
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
743743
apply_autostash(opts);
744-
close_all_packs(the_repository->objects);
744+
close_object_store(the_repository->objects);
745745
/*
746746
* We ignore errors in 'gc --auto', since the
747747
* user should see them.

builtin/receive-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
20422042
proc.git_cmd = 1;
20432043
proc.argv = argv_gc_auto;
20442044

2045-
close_all_packs(the_repository->objects);
2045+
close_object_store(the_repository->objects);
20462046
if (!start_command(&proc)) {
20472047
if (use_sideband)
20482048
copy_to_sideband(proc.err, -1, NULL);

builtin/repack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
422422
if (!names.nr && !po_args.quiet)
423423
printf_ln(_("Nothing new to pack."));
424424

425-
close_all_packs(the_repository->objects);
425+
close_object_store(the_repository->objects);
426426

427427
/*
428428
* Ok we have prepared all new packfiles.

commit-graph.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ int generation_numbers_enabled(struct repository *r)
361361
return !!first_generation;
362362
}
363363

364-
void close_commit_graph(struct repository *r)
364+
void close_commit_graph(struct raw_object_store *o)
365365
{
366-
free_commit_graph(r->objects->commit_graph);
367-
r->objects->commit_graph = NULL;
366+
free_commit_graph(o->commit_graph);
367+
o->commit_graph = NULL;
368368
}
369369

370370
static int bsearch_graph(struct commit_graph *g, struct object_id *oid, uint32_t *pos)
@@ -1093,7 +1093,7 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
10931093
stop_progress(&ctx->progress);
10941094
strbuf_release(&progress_title);
10951095

1096-
close_commit_graph(ctx->r);
1096+
close_commit_graph(ctx->r->objects);
10971097
finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC);
10981098
commit_lock_file(&lk);
10991099

commit-graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int write_commit_graph(const char *obj_dir,
8282

8383
int verify_commit_graph(struct repository *r, struct commit_graph *g);
8484

85-
void close_commit_graph(struct repository *);
85+
void close_commit_graph(struct raw_object_store *);
8686
void free_commit_graph(struct commit_graph *);
8787

8888
#endif

0 commit comments

Comments
 (0)