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

Re: base-commit when prerequisite-patch-id is specified

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 29, 2024, 00:06 UTC
Message-ID
<xmqqzfuhsxzi.fsf@gitster.g>
In-Reply-To
<20240328-vehement-fine-tarantula-2b864a@lemur>
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
Show 15 quoted lines
> Hello:
>
> I'm working on automatically supporting dependencies with b4, and I'm curious
> if "base-commit" should be used to indicate where to start applying
> dependencies, or if that's purely for the patch series itself.
>
> E.g.:
>
>     base-commit: [commit-ish]
>     prerequisite-patch-id: abcd...1234
>     prerequisite-patch-id: cdef...3456
>
> In this situation, does base-commit mean:
> 1. where to apply abcd...1234
> 2. the sha we should find when we apply both prerequisite patches
"git format-patch --help" has this to say:
  Imagine that on top of the public commit P, you applied well-known patches X, Y
  and Z from somebody else, and then built your three-patch series A, B, C, the
  history would be like:
      ---P---X---Y---Z---A---B---C
  With git format-patch --base=P -3 C (or variants thereof, e.g. with --cover-letter
  or using Z..C instead of -3 C to specify the range), the base tree information
  block is shown at the end of the first message the command outputs (either the
  first patch, or the cover letter), like this:
      base-commit: P
      prerequisite-patch-id: X
      prerequisite-patch-id: Y
      prerequisite-patch-id: Z

So, it appears to me that the only way to read your example is that there is P, on top of which abcd...1234 and cdef...3456 should be applied, before our series is ready to be applied on top?

There is no way to express the desired topology on top of P that X, Y and Z are built, and I think it is acceptable to assume the author of such a patch series, who took it out of a history other than the above depicted single strand of pearls, e.g. a mergy one in the example given in the "git format-patch --help" output:

  For non-linear topology, such as
      ---P---X---A---M---C
          \         /
           Y---Z---B
  You can also use git format-patch --base=P -3 C to generate patches for A, B and
  C, and the identifiers for P, X, Y, Z are appended at the end of the first
  message.

is responsible to ensure that linear application of X Y Z A B C on top of P should give the same result as C the author had taken the patches out of. The recipient, or b4 tool, cannot do anything with the existing information.

Previous: Konstantin Ryabitsev
Message 2 of 2 in “base-commit when prerequisite-patch-id is specified”
  1. Konstantin RyabitsevMar 28, 2024
  2. Junio C HamanoMar 29, 2024

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.