diff options
| author | Justin Tobler <jltobler@gmail.com> | 2025-09-16 13:29:38 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-09-16 11:37:06 -0700 |
| commit | ce1661f9da70ea2ffcb54f7b544410fad26e965d (patch) | |
| tree | 3c6c03b10aa74bdece59ddae976af6550bca1ee0 /builtin/add.c | |
| parent | ed0f5f93e9f0b0b3cc1a37ee5b10b625590f08c8 (diff) | |
odb: add transaction interface
Transactions are managed via the {begin,end}_odb_transaction() function
in the object-file subsystem and its implementation is specific to the
files object source. Introduce odb_transaction_{begin,commit}() in the
odb subsystem to provide an eventual object source agnostic means to
manage transactions.
Update call sites to instead manage transactions through the odb
subsystem. Also rename {begin,end}_odb_transaction() functions to
object_file_transaction_{begin,commit}() to clarify the object source it
supports.
Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
| -rw-r--r-- | builtin/add.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c index 8294366d68..bf312c40be 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -15,6 +15,7 @@ #include "pathspec.h" #include "run-command.h" #include "object-file.h" +#include "odb.h" #include "parse-options.h" #include "path.h" #include "preload-index.h" @@ -575,7 +576,7 @@ int cmd_add(int argc, string_list_clear(&only_match_skip_worktree, 0); } - transaction = begin_odb_transaction(repo->objects); + transaction = odb_transaction_begin(repo->objects); ps_matched = xcalloc(pathspec.nr, 1); if (add_renormalize) @@ -594,7 +595,7 @@ int cmd_add(int argc, if (chmod_arg && pathspec.nr) exit_status |= chmod_pathspec(repo, &pathspec, chmod_arg[0], show_only); - end_odb_transaction(transaction); + odb_transaction_commit(transaction); finish: if (write_locked_index(repo->index, &lock_file, |
