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

Re: [PATCH/RFC] Support --append-trailer in cherry-pick and revert

From
Jeff King <peff@peff.net>
Date
Nov 7, 2018, 21:02 UTC
Message-ID
<20181107210256.GC30078@sigill.intra.peff.net>
In-Reply-To
<CACsJy8DTdW-P9zG3DBPArjhZU1VwwBmd7qNibyHxYkyjRrdWmw@mail.gmail.com>
On Wed, Nov 07, 2018 at 04:30:38PM +0100, Duy Nguyen wrote:
Show 30 quoted lines
> > Could we help the reading scripts by normalizing old and new output via
> > interpret-trailers, %(trailers), etc?
> >
> > I think "(cherry picked from ...)" is already considered a trailer by
> > the trailer code. If the caller instructs us to, we could probably
> > rewrite it to:
> >
> >   Cherry-picked-from: ...
> >
> > in the output. Then the end-game is that scripts should just use
> > interpret-trailers, etc, and old and new commits will Just Work.
> 
> There is still one thing to settle. "revert -m1" could produce
> something like this
> 
>     This reverts commit <SHA1>, reversing
>     changes made to <SHA2>.
> 
> My proposal produces this
> 
>     Reverts: <SHA1>^2
> 
> And I can't really convert the former to latter without accessing
> object database (probably not a good idea?) to check if SHA2 is the
> second parent of SHA1. So either
> 
>  - I access object database anyway
>  - Generate just "Reverts: <SHA1>" (i.e. losing info) with interpret-trailers
>  - Change Reverts: tag to a different output format, or maybe use two
> tags instead.

IMHO the revert case is way less interesting for automated parsing. In a workflow like Git's, cherry-picks aren't very common, but there _are_ workflows where there's a lot of cherry-picking between dev/release branches, and automated analysis is useful there. Whereas for revert, it's almost always a human-scale thing. A commit was bad, so you revert it. The annotation is useful if you're digging, but it's not generally going to be a fundamental part of a workflow. And it's not really any different than fixing a bug later.

And I think that's reflected in the way we just casually stick the reverted oid in the human-readable part of the commit message (and the lack of any tools to parse it).

So IMHO it would be OK to treat this less carefully than the cherry-pick case.

-Peff
Previous: Duy NguyenNext: Junio C Hamano
Message 15 of 25 in “sequencer.c: record revert/cherry-pick commit with trailer lines”
  1. sequencer.c: record revert/cherry-pick commit with trailer linesNguyễn Thái Ngọc Duy, Nov 4, 2018
  2. Phillip WoodNov 4, 2018
  3. Duy NguyenNov 4, 2018
  4. Phillip WoodNov 4, 2018
  5. Johannes SchindelinNov 5, 2018
  6. sequencer.c: record revert/cherry-pick commit with trailer linesNguyễn Thái Ngọc Duy, Nov 4, 2018
  7. brian m. carlsonNov 4, 2018
  8. Duy NguyenNov 5, 2018
  9. Support --append-trailer in cherry-pick and revertNguyễn Thái Ngọc Duy, Nov 6, 2018
  10. Ævar Arnfjörð BjarmasonNov 6, 2018
  11. Jeff KingNov 6, 2018
  12. Jeff KingNov 6, 2018
  13. Junio C HamanoNov 7, 2018
  14. Duy NguyenNov 7, 2018
  15. Jeff KingNov 7, 2018
  16. Junio C HamanoNov 8, 2018
  17. Jeff KingNov 8, 2018
  18. Junio C HamanoNov 8, 2018
  19. Junio C HamanoNov 7, 2018
  20. Junio C HamanoNov 5, 2018
  21. Duy NguyenNov 5, 2018
  22. Junio C HamanoNov 6, 2018
  23. Ævar Arnfjörð BjarmasonNov 6, 2018
  24. Duy NguyenNov 6, 2018
  25. Ævar Arnfjörð BjarmasonNov 6, 2018

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.