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

Re: Support for a series of patches, i.e. patchset or changeset?

From
Jeff King <peff@peff.net>
Date
Nov 8, 2012, 19:09 UTC
Message-ID
<20121108190944.GO15560@sigill.intra.peff.net>
In-Reply-To
<CAMPhdO-Z3E352KbTvnrxJqCecAUGfHCwOoFRUKzObh35uLnrSw@mail.gmail.com>
On Tue, Nov 06, 2012 at 08:58:35AM +0800, Eric Miao wrote:
Show 18 quoted lines
> > So, then the question is: What do you know/have? Is your patch the
> > output of "git format-patch", "git diff", or just some sort of diff
> > without any git information?
> 
> That doesn't matter, all the info can be obtained from the SHA1 id, the
> question is: do we have a mechanism in git (or hopefully we could add)
> to record the patchset or series the patch belongs to, without people to
> guess heuristically.
> 
> E.g. when we merged a series of patches:
> 
>   [PATCH 00/08]
>   [PATCH 01/08]
>   ...
>   [PATCH 08/08]
> 
> How do we know this whole series after merged when only one of these
> commits are known?

Others have described how you can infer this structure from the history graph, but as you noted, the graph does not always match the series that was sent, nor does it contain some of the meta information about the cover letter, associated discussions, etc.

If you want to track the mapping between mailed patches (or any other form of changeset id) to commits, you can put it in git in one of two places:

  1. In a pseudo-header at the end of the commit message. E.g., you
     could use the message-id of the cover letter as a unique identifier
     for the changeset, and put "Changeset: $MID" at the end of each
     commit message. Then you can use "--grep" to find other entries
     from the same changeset.
  2. You can use git-notes to store the same information outside of the
     commit message. This doesn't get pushed around automatically with
     the history, but it means your commit messages are not polluted,
     and you can make annotations after the commits are set in stone.

I do not use Gerrit, but I recall that they do something like (1) to mark changesets. For git development, one of the contributors does (2) to point notes at mailing list threads (I think he uses a script to match up mails and commits after the fact).

But fundamentally the idea of "this is a set of logical changes" is not represented in git's DAG. It's up to you to store changeset tokens if you care about them.

-Peff
Previous: Eric MiaoNext: Eric Miao
Message 10 of 13 in “Support for a series of patches, i.e. patchset or changeset?”
  1. Eric MiaoNov 5, 2012
  2. Michael J GruberNov 5, 2012
  3. Eric MiaoNov 5, 2012
  4. Michael J GruberNov 5, 2012
  5. Eric MiaoNov 6, 2012
  6. Johannes SixtNov 6, 2012
  7. Eric MiaoNov 6, 2012
  8. Johannes SixtNov 6, 2012
  9. Eric MiaoNov 7, 2012
  10. Jeff KingNov 8, 2012
  11. Eric MiaoNov 9, 2012
  12. Enrico WeigeltNov 10, 2012
  13. Eric MiaoNov 10, 2012

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.