]> Kevux Git Server - rit/commit
builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE
authorTian Yuchen <cat@malon.dev>
Thu, 12 Mar 2026 16:42:03 +0000 (00:42 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Mar 2026 17:03:23 +0000 (10:03 -0700)
commit78827970ecf1cb853fc2c9059c180f91fa154c97
treed3ca57ff856ebf78f051ac2e085d0767a7c5ee3e
parentd181b9354cf85b44455ce3ca9e6af0b9559e0ae2
builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE

The 'cmd_mktree()' function already receives a 'struct repository *repo'
pointer, but it was previously marked as UNUSED.

Pass the 'repo' pointer down to 'mktree_line()' and 'write_tree()'.
Consequently, remove the 'USE_THE_REPOSITORY_VARIABLE' macro, replace
usages of 'the_repository', and swap 'parse_oid_hex()' with its context-aware
version 'parse_oid_hex_algop()'.

This refactoring is safe because 'cmd_mktree()' is registered with the
'RUN_SETUP' flag in 'git.c', which guarantees that the command is
executed within a initialized repository, ensuring that the passed 'repo'
pointer is never 'NULL'.

Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mktree.c