]> git.ipfire.org Git - thirdparty/git.git/commitdiff
unpack-trees: use repository from index instead of global
authorJayesh Daga <jayeshdaga99@gmail.com>
Tue, 31 Mar 2026 15:34:27 +0000 (15:34 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Mar 2026 19:44:25 +0000 (12:44 -0700)
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>
unpack-trees.c

index 191b9d4769a7b48b9637486e6fc80dc316f175d7..b42020f16b10ae665aa434a6b1cda5bf1c434e2c 100644 (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;