Re: [PATCH] add-patch: use repository instance from add_i_state instead of the_repository
- From
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
- Date
- Mar 17, 2026, 16:51 UTC
- Message-ID
- <20260317165230.628705-1-shreyanshpaliwalcmsmn@gmail.com>
- In-Reply-To
- <xmqqzf46l7x1.fsf@gitster.g>
Show 17 quoted lines
> > 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. > > So we can call this "reduce" but cannot say "eliminate" yet, as the > files uses comment_line_str? > > The <environment.h> header lists some global variables inside > "#ifndef USE_THE_REPOSITORY_VARIABLE/#endif" block, and the > comment-line stuff is among them. >
Yes that's right, there is an instance of comment_line_str, should I add this in the commit message and send a reroll ?