]> git.99rst.org Git - git.git/commit
add-patch: use repository instance from add_i_state instead of the_repository
authorShreyansh Paliwal <redacted>
Tue, 17 Mar 2026 15:50:29 +0000 (21:20 +0530)
committerJunio C Hamano <redacted>
Tue, 17 Mar 2026 16:27:13 +0000 (09:27 -0700)
commit3cfe355ca74aae5cf90a4eca73a341732b0eb456
tree82ab35ab20bbda276f6f71662a2bb3db672ace17
parentca1db8a0f7dc0dbea892e99f5b37c5fe5861be71
add-patch: use repository instance from add_i_state instead of the_repository

Functions parse_diff(), edit_hunk_manually() and patch_update_file() use
the_repository even though a repository instance is already available via
struct add_i_state s which is defined in struct add_p_state *s.

Use 's->s.r' instead of the_repository to avoid relying on global state. All
callers pass a valid add_p_state and this does not change any behavior.

This aligns with the ongoing effort to reduce usage of the_repository global
state.

Signed-off-by: Shreyansh Paliwal <redacted>
Signed-off-by: Junio C Hamano <redacted>
add-patch.c
git clone https://git.99rst.org/PROJECT