aboutsummaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2025-08-22 16:34:58 -0500
committerJunio C Hamano <gitster@pobox.com>2025-08-25 09:48:13 -0700
commitb3361447256bb92a1dbdda910a33cfb1d6fc8f88 (patch)
treed6d52cf269972a5950dc7aac44204e2a16d274bb /read-cache.c
parentbulk-checkin: introduce object database transaction structure (diff)
downloadgit-b3361447256bb92a1dbdda910a33cfb1d6fc8f88.tar.gz
git-b3361447256bb92a1dbdda910a33cfb1d6fc8f88.zip
bulk-checkin: remove global transaction state
Object database transactions in the bulk-checkin subsystem rely on global state to track transaction status. Stop relying on global state and instead store the transaction in the `struct object_database`. Functions that operate on transactions are updated to now wire transaction state. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index 06ad74db22..229b8ef11c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -3947,6 +3947,7 @@ int add_files_to_cache(struct repository *repo, const char *prefix,
const struct pathspec *pathspec, char *ps_matched,
int include_sparse, int flags)
{
+ struct odb_transaction *transaction;
struct update_callback_data data;
struct rev_info rev;
@@ -3972,9 +3973,9 @@ int add_files_to_cache(struct repository *repo, const char *prefix,
* This function is invoked from commands other than 'add', which
* may not have their own transaction active.
*/
- begin_odb_transaction();
+ transaction = begin_odb_transaction(repo->objects);
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
- end_odb_transaction();
+ end_odb_transaction(transaction);
release_revisions(&rev);
return !!data.add_errors;