8000 builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE by malon7782 · Pull Request #2238 · git/git · GitHub
[go: up one dir, main page]

Skip to content

builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE#2238

Open
malon7782 wants to merge 1 commit intogit:masterfrom
malon7782:fix/mktree
Open

builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE#2238
malon7782 wants to merge 1 commit intogit:masterfrom
malon7782:fix/mktree

Conversation

@malon7782
Copy link
Contributor

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'.

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>
@gitgitgadget-git
Copy link

There is an issue in commit ed98b0a:
builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE

  • Lines in the body of the commit messages should be wrapped between 60 and 76 characters.
    Indented lines, and lines without whitespace, are exempt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0