git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] add-patch: use repository instance from add_i_state instead of the_repository

From
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Date
Mar 18, 2026, 07:01 UTC
Message-ID
<20260318070237.659845-1-shreyanshpaliwalcmsmn@gmail.com>
In-Reply-To
<xmqqo6kmjj9d.fsf@gitster.g>
Show 55 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
> > Having said that, please make sure your patch works well with
> > patches others are working on.  In this case, s->s.r would no longer
> > exist after this one:
> >
> > commit d51b61f5dab9c8e715fa792f31d572bc96fb5687
> > Author: Patrick Steinhardt <ps@pks.im>
> > Date:   Mon Mar 2 13:13:07 2026 +0100
> >
> >     add-patch: remove dependency on "add-interactive" subsystem
> >
> >     With the preceding commit we have split out interactive configuration
> >     that is used by both "git add -p" and "git add -i". But we still
> >     initialize that configuration in the "add -p" subsystem by calling
> >     `init_add_i_state()`, even though we only do so to initialize the
> >     interactive configuration as well as a repository pointer.
> >
> >     Stop doing so and instead store and initialize the interactive
> >     configuration in `struct add_p_state` directly.
> >
> >     Signed-off-by: Patrick Steinhardt <ps@pks.im>
> >     Signed-off-by: Junio C Hamano <gitster@pobox.com>
> >
> > A good way to ensure that you do not send a patch that does not work
> > well with others is to make a trial merge to 'next' and 'seen' and
> > ensure that they produce working Git, after making sure your patch
> > applied directly on top of 'master' works well.
>
> The above "good way" is to notice and stop yourself from sending a
> patch that wants s->s.r to still exist.
>
> After that happens, it is tempting to rebuild your change on top of
> 'next'.  But please do *NOT* do so.
>
> Instead, identify such dependencies (i.e. other topics with changes
> relative to what 'master' has, that break what you developed
> directly on top of 'master'), and then merge them to 'master'
> yourself.  And then bulid your topic on top of the merge.  Work hard
> to limit your dependencies to absolute minimum, as these topics will
> take your work hostage---until they get merged down to 'master',
> your topic will not be able to be merged to 'master'.
>
> In this case, you'll be likely to do something like
>
>     $ git checkout -b sp/add-patch-with-fewer-the-repository origin/master
>     $ git merge --no-ff origin/ps-history-split
>     $ edit ... && git add ... && make test
>     $ git commit -m 'add-patch: use repository instance...'
>
> to build your single patch series on top of 'master' taken from my
> tree, with Patrick's history-split topic merged into it.
> After the commit is made, send out only your work (i.e., above the
> merge of Patrick's topic) to the list and you're done.
>

Thanks a lot for this useful tip. Going forward, I will first try to ensure that there are no on-going conflicting patches by a trial merge to seen/next branch. Then after if there are any I would merge those dependent patches locally on a copy of master, thereafter build my changes on that and send them.

Best, Shreyansh

Previous: Junio C HamanoNext: Shreyansh Paliwal
Message 7 of 9 in “add-patch: use repository instance from add_i_state instead of the_repository”
  1. add-patch: use repository instance from add_i_state instead of the_repositoryShreyansh Paliwal, Mar 17, 2026
  2. Junio C HamanoMar 17, 2026
  3. Shreyansh PaliwalMar 17, 2026
  4. Junio C HamanoMar 17, 2026
  5. Junio C HamanoMar 17, 2026
  6. Junio C HamanoMar 17, 2026
  7. Shreyansh PaliwalMar 18, 2026
  8. add-patch: use repository instance from add_p_state instead of the_repositoryShreyansh Paliwal, Mar 18, 2026
  9. Junio C HamanoMar 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.