threads / discuss / 61220

base-commit when prerequisite-patch-id is specified

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

## tl;dr

2 messages between Mar 28, 2024 and Mar 29, 2024.

replies: 1people: 2as markdown or json

Konstantin Ryabitsev· Mar 28, 2024, 21:34 UTC · lore
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

In theory, #2 makes no sense, because we don't know where to apply prerequisite-patch-id's and therefore can't reasonably arrive at whatever is specified as "base-commit".

I expect the answer is "it's whatever you think it should be," because prerequisite-patch-id's aren't really widely used, but I'll be happy to learn that there's an established practice.

-K
Junio C Hamano· Mar 29, 2024, 00:06 UTC · re: Konstantin Ryabitsev · lore

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

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.

← back to recent threads