unpack-trees: use repository from index instead of global

unpack_trees() currently initializes its repository from the
global 'the_repository', even though a repository instance is
already available via the source index.

Use 'o->src_index->repo' instead of the global variable,
reducing reliance on global repository state.

This is a step towards eliminating global repository usage in
unpack_trees().

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jayesh Daga
2026-03-31 15:34:27 +00:00
committed by Junio C Hamano
parent 0df739ea34
commit c74767b7a3

View File

@@ -1882,7 +1882,7 @@ static int verify_absent(const struct cache_entry *,
*/
int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options *o)
{
struct repository *repo = the_repository;
struct repository *repo = o->src_index->repo;
int i, ret;
static struct cache_entry *dfc;
struct pattern_list pl;