Skip to content

Commit c74767b

Browse files
jayesh0104gitster
authored andcommitted
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>
1 parent 0df739e commit c74767b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unpack-trees.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ static int verify_absent(const struct cache_entry *,
18821882
*/
18831883
int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options *o)
18841884
{
1885-
struct repository *repo = the_repository;
1885+
struct repository *repo = o->src_index->repo;
18861886
int i, ret;
18871887
static struct cache_entry *dfc;
18881888
struct pattern_list pl;

0 commit comments

Comments
 (0)