Skip to content

Commit 7d00521

Browse files
committed
Merge branch 'jt/de-global-bulk-checkin'
The bulk-checkin code used to depend on a file-scope static singleton variable, which has been updated to pass an instance throughout the callchain. * jt/de-global-bulk-checkin: bulk-checkin: use repository variable from transaction bulk-checkin: require transaction for index_blob_bulk_checkin() bulk-checkin: remove global transaction state bulk-checkin: introduce object database transaction structure
2 parents 92c87bd + ddc0b56 commit 7d00521

File tree

9 files changed

+141
-101
lines changed

9 files changed

+141
-101
lines changed

builtin/add.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ int cmd_add(int argc,
389389
char *seen = NULL;
390390
char *ps_matched = NULL;
391391
struct lock_file lock_file = LOCK_INIT;
392+
struct odb_transaction *transaction;
392393

393394
repo_config(repo, add_config, NULL);
394395

@@ -574,7 +575,7 @@ int cmd_add(int argc,
574575
string_list_clear(&only_match_skip_worktree, 0);
575576
}
576577

577-
begin_odb_transaction();
578+
transaction = begin_odb_transaction(repo->objects);
578579

579580
ps_matched = xcalloc(pathspec.nr, 1);
580581
if (add_renormalize)
@@ -593,7 +594,7 @@ int cmd_add(int argc,
593594

594595
if (chmod_arg && pathspec.nr)
595596
exit_status |= chmod_pathspec(repo, &pathspec, chmod_arg[0], show_only);
596-
end_odb_transaction();
597+
end_odb_transaction(transaction);
597598

598599
finish:
599600
if (write_locked_index(repo->index, &lock_file,

builtin/unpack-objects.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ static void unpack_all(void)
584584
{
585585
int i;
586586
unsigned char *hdr = fill(sizeof(struct pack_header));
587+
struct odb_transaction *transaction;
587588

588589
if (get_be32(hdr) != PACK_SIGNATURE)
589590
die("bad pack file");
@@ -599,12 +600,12 @@ static void unpack_all(void)
599600
progress = start_progress(the_repository,
600601
_("Unpacking objects"), nr_objects);
601602
CALLOC_ARRAY(obj_list, nr_objects);
602-
begin_odb_transaction();
603+
transaction = begin_odb_transaction(the_repository->objects);
603604
for (i = 0; i < nr_objects; i++) {
604605
unpack_one(i);
605606
display_progress(progress, i + 1);
606607
}
607-
end_odb_transaction();
608+
end_odb_transaction(transaction);
608609
stop_progress(&progress);
609610

610611
if (delta_list)

builtin/update-index.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static void report(const char *fmt, ...)
7777
* objects invisible while a transaction is active, so flush the
7878
* transaction here before reporting a change made by update-index.
7979
*/
80-
flush_odb_transaction();
80+
flush_odb_transaction(the_repository->objects->transaction);
8181
va_start(vp, fmt);
8282
vprintf(fmt, vp);
8383
putchar('\n');
@@ -940,6 +940,7 @@ int cmd_update_index(int argc,
940940
strbuf_getline_fn getline_fn;
941941
int parseopt_state = PARSE_OPT_UNKNOWN;
942942
struct repository *r = the_repository;
943+
struct odb_transaction *transaction;
943944
struct option options[] = {
944945
OPT_BIT('q', NULL, &refresh_args.flags,
945946
N_("continue refresh even when index needs update"),
@@ -1130,7 +1131,7 @@ int cmd_update_index(int argc,
11301131
* Allow the object layer to optimize adding multiple objects in
11311132
* a batch.
11321133
*/
1133-
begin_odb_transaction();
1134+
transaction = begin_odb_transaction(the_repository->objects);
11341135
while (ctx.argc) {
11351136
if (parseopt_state != PARSE_OPT_DONE)
11361137
parseopt_state = parse_options_step(&ctx, options,
@@ -1213,7 +1214,7 @@ int cmd_update_index(int argc,
12131214
/*
12141215
* By now we have added all of the new objects
12151216
*/
1216-
end_odb_transaction();
1217+
end_odb_transaction(transaction);
12171218

12181219
if (split_index > 0) {
12191220
if (repo_config_get_split_index(the_repository) == 0)

0 commit comments

Comments
 (0)