cache-tree: use ODB transaction around writing a tree

Take advantage of the odb transaction infrastructure around writing the cached tree to the object database. Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Neeraj Singh committed Apr 4, 2022 at 22:20 UTC 4d33e2ba6b9db6a28085b2ef7e46d30a981875ab
1 file changed +3
cache-tree.c
+3
@@ -3,6 +3,7 @@
3 #include "tree.h"
4 #include "tree-walk.h"
5 #include "cache-tree.h"
6 +#include "bulk-checkin.h"
7 #include "object-store.h"
8 #include "replace-object.h"
9 #include "promisor-remote.h"
@@ -474,8 +475,10 @@ int cache_tree_update(struct index_state *istate, int flags)
475
476 trace_performance_enter();
477 trace2_region_enter("cache_tree", "update", the_repository);
478 + begin_odb_transaction();
479 i = update_one(istate->cache_tree, istate->cache, istate->cache_nr,
480 "", 0, &skip, flags);
481 + end_odb_transaction();
482 trace2_region_leave("cache_tree", "update", the_repository);
483 trace_performance_leave("cache_tree_update");
484 if (i < 0)