From: Junio C Hamano <gitster@pobox.com>
To: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] add-patch: use repository instance from add_i_state instead of the_repository
Date: Tue, 17 Mar 2026 11:04:58 -0700 [thread overview]
Message-ID: <xmqqh5qel4c5.fsf@gitster.g> (raw)
In-Reply-To: <20260317165230.628705-1-shreyanshpaliwalcmsmn@gmail.com> (Shreyansh Paliwal's message of "Tue, 17 Mar 2026 22:21:38 +0530")
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> writes:
>> > 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 ?
No need to. I was just wondering if there are something I missed.
next prev parent reply other threads:[~2026-03-17 18:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 15:50 [PATCH] add-patch: use repository instance from add_i_state instead of the_repository Shreyansh Paliwal
2026-03-17 16:47 ` Junio C Hamano
2026-03-17 16:51 ` Shreyansh Paliwal
2026-03-17 18:04 ` Junio C Hamano [this message]
2026-03-17 20:10 ` Junio C Hamano
2026-03-17 20:25 ` Junio C Hamano
2026-03-18 7:01 ` Shreyansh Paliwal
2026-03-18 9:00 ` [PATCH v2 ] add-patch: use repository instance from add_p_state " Shreyansh Paliwal
2026-03-18 16:43 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh5qel4c5.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=shreyanshpaliwalcmsmn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.