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

[RFC] cherry-pick using multiple parents to implement -x

From
Stephen R. van den Berg <srb@cuci.nl>
Date
Sep 7, 2008, 10:34 UTC
Message-ID
<20080907103415.GA3139@cuci.nl>

I've been converting some old CVS repositories to git, and as it turns out, these repositories consist of a number of main branches of the same project that were created at several points in time (the stable release branches), and the branches contain numerous backports (and a few forward ports) between each other.

I.e. the branches split off each other at various points in time, and evolved independently ever since (except for the numerous backports).

Now, the backports can be implemented using a mere "git cherry-pick -x", but that creates this silly text references to the original commits. I'd rather use something that gitk can visualise.

So I tried to use the parents of the commit to reference the origin(s). I.e. the first parent links to the linear history on a given branch, but the second (and possibly more) parents point to the cherry-picked back-ported commit from another branch. This graft-constructed repository is then fed to filter-branch to make it permanent. To view it try: git://pike-git.lysator.liu.se/pikex

This works quite well and shows the following results:
- gitk shows proper grafts.
- gitk properly shows a zero-diff between the new commit and the
  commits we cherry-picked from.
- It even works perfectly when picking from multiple parents.
- gitk is confused in its display of tags preceding and following this
  commit (depending on the situation it mixes up the branches).

Obviously the reason it works rather well is because git can actually distinguish between a merge and a backport because of the way the contents of the trees change.

The questions now are:
- Would there be good reason not to record the backport/forwardport
  relationship in the additional parents of a commit?
- Since most of the git machinery (git diff, and gitk, most notably)
  seem to work just fine when using parents for that purpose, would it
  be acceptable to create a patch to cherry-pick to support an option to
  record the backport/forwardport relationship in the second (or more)
  parent field(s)?
- And depending on an affirmative on the previous question, would it be
  acceptable to teach the gitk preceding/following tag listing to deal
  with these backport/forwardports ?
-- 
Sincerely,
           Stephen R. van den Berg.

"The future is here, it's just not widely distributed yet." -- William Gibson
Next: Jeff King
Message 1 of 25 in “[RFC] cherry-pick using multiple parents to implement -x”
  1. Stephen R. van den BergSep 7, 2008
  2. Jeff KingSep 7, 2008
  3. Stephen R. van den BergSep 7, 2008
  4. Jeff KingSep 7, 2008
  5. Stephen R. van den BergSep 7, 2008
  6. Jeff KingSep 8, 2008
  7. Stephen R. van den BergSep 8, 2008
  8. Junio C HamanoSep 7, 2008
  9. Stephen R. van den BergSep 7, 2008
  10. Thomas RastSep 7, 2008
  11. Junio C HamanoSep 7, 2008
  12. Junio C HamanoSep 7, 2008
  13. Paolo BonziniSep 8, 2008
  14. Junio C HamanoSep 8, 2008
  15. Junio C HamanoSep 7, 2008
  16. Stephen R. van den BergSep 8, 2008
  17. Paolo BonziniSep 8, 2008
  18. Stephen R. van den BergSep 8, 2008
  19. Jakub NarebskiSep 8, 2008
  20. Paolo BonziniSep 8, 2008
  21. Shawn O. PearceSep 8, 2008
  22. Stephen R. van den BergSep 8, 2008
  23. Shawn O. PearceSep 8, 2008
  24. Stephen R. van den BergSep 9, 2008
  25. Paolo BonziniSep 8, 2008

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.