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

Re: [RFC] origin link for cherry-pick and revert

From
Stephen R. van den Berg <srb@cuci.nl>
Date
Sep 11, 2008, 15:32 UTC
Message-ID
<20080911153202.GD2056@cuci.nl>
In-Reply-To
<20080911135146.GE5082@mit.edu>
Theodore Tso wrote:
>On Thu, Sep 11, 2008 at 02:31:48PM +0200, Stephen R. van den Berg wrote:
>> Well, the train of thought here goes as follows:
>> 2. Add support to cherry-pick/revert to actually generate the field upon
>>    demand.
>"git cherry-pick -x" already generates the field you want.

Well, sort of. In order for swift parsing it should be a real field, i.e. it should not be an English sentence (in order to avoid people accidentally translating it); and it should list a pair of hashes (patches/changesets are defined by the difference between two tree snapshots). So it would be a -o option most likely, in order to provide backward compatibility to the users of -x.

>> 3. Then add support to prune/gc/fsck/blame/log --graph to take the field
>>    into account.
Show 5 quoted lines
>Um, why should "git fsck", or "git prune" or "git gc" need to
>understand about this field?  What were you saying about unclean
>semantics, again?  I thought you claimed that dangling origin links
>were OK?  So why the heck should git fsck care?  And why shouldn't
>gc/prune drop objects that are only referenced via the origin link.

Dangling origin links are ok only if the developer in charge of the repository doesn't care about the commits/branches they point to. The definition of a "caring developer" is formalised by the fact that the offending commits are already present in the repository or not.

This implies that fsck will skip the field if the hashes in question are unreachable in the current repository. If they are reachable though, fsck will follow the link and check the whole tree referenced by the origin link. Obviously there are only two conditions for an origin link: either the hash points to an unreachable object or the hash points to a reachable object of type commit (and all associated checks that go with any commit).

gc will preserve the commits the origin links point to once they are reachable. I.e. if the developer doesn't care about the commits the origin links point to (i.e. if the branches are not reachable) then gc just skips them, if the developer *does* care, the origin links are used to keep those objects alive (and, of course, all their parenthood).

>> 4. Add support to filter-branch/rebase to renumber the field if necessary.
Show 5 quoted lines
>As we discussed earlier in some cases renumbering the field is not the
>right thing to do, especially if the commit in question has already
>been cherry-picked --- and you don't know that.  Again, this is why
>prototyping it outside of the core git is so useful; it will show up
>some of these fundamental flaws in the origin link proposal.

I agree that the behaviour of especially rebase with respect to the origin links is still something that needs to be thought through. I'm not convinced you are right, but I'm not convinced you are wrong either.

>> Well, and after having done steps 1 to 5, the net result is that it
>> works almost as if the field is present in the header, except that:
>> - It is now at the end of the body in the commit message.
>> - It takes more time to find and parse it.
>A proof of concept, even if it isn't fully performant, is useful to
>prove that an idea actually has merit --- which clearly not everyone
>believes at this point.
Quite.
>I'll also note that having a ***local*** database to cache the origin
>link is a great way of short-circuiting the performance difficulties.
>If it works, then it will be a lot easier to convince people that
>perhaps it should be done git-core, and by modifying core git functions.

Creating local databases for these kinds of structures feels kludgy somehow, since the git hash objects essentially *are* a working database. I have not checked yet if git already has some kind of ready-to-use local database lib inside which I could reuse for that.

>Alternatively, if you think this is such a great idea, why don't you
>grab a copy of the git repository, and start hacking the idea
>yourself?

Actually, in the first hour after posting the initial mail/proposal I already had altered a local version of git to support the origin links in commit.[ch], --topo-order and fsck. Before hacking further I decided to get some feedback first to see if someone would come up with something better. And they did, instead of the mainline number, I decided that using two hashes is better. Once the dust has settled, I'll fill in the rest of the code.

>  If you have running code, it tends to make the idea much
>more concrete, and much easier to evaluate.

Agreed, but then again, most of the programming is done without touching any code (the design phase), which is where we are now. Once the design is scrutinised (as far as possible), the coding can begin (continue). The feedback so far was very helpful, and caused me to explore (and dismiss) some of the alternate avenues to achieve the desired functionality.

>  Or were you hoping to
>convince other people to do all of this programming for you?
I've never needed that so far, and will not need that here either.
-- 
Sincerely,
           Stephen R. van den Berg.
"There are three types of people in the world;
 those who can count, and those who can't."
Previous: Theodore TsoNext: Theodore Tso
Message 35 of 137 in “[RFC] origin link for cherry-pick and revert”
  1. Stephen R. van den BergSep 9, 2008
  2. Paolo BonziniSep 9, 2008
  3. Stephen R. van den BergSep 9, 2008
  4. Stephen R. van den BergSep 9, 2008
  5. Jakub NarebskiSep 9, 2008
  6. Steven GrimmSep 9, 2008
  7. Stephen R. van den BergSep 9, 2008
  8. Jeff KingSep 9, 2008
  9. Stephen R. van den BergSep 9, 2008
  10. Junio C HamanoSep 9, 2008
  11. Shawn O. PearceSep 9, 2008
  12. Jeff KingSep 9, 2008
  13. Jakub NarebskiSep 9, 2008
  14. Jakub NarebskiSep 9, 2008
  15. Paolo BonziniSep 10, 2008
  16. Stephen R. van den BergSep 10, 2008
  17. Junio C HamanoSep 10, 2008
  18. Stephen R. van den BergSep 10, 2008
  19. Junio C HamanoSep 9, 2008
  20. Jeff KingSep 9, 2008
  21. Stephen R. van den BergSep 9, 2008
  22. Jakub NarebskiSep 9, 2008
  23. Stephen R. van den BergSep 9, 2008
  24. Linus TorvaldsSep 9, 2008
  25. Stephen R. van den BergSep 9, 2008
  26. Linus TorvaldsSep 10, 2008
  27. Stephen R. van den BergSep 10, 2008
  28. Linus TorvaldsSep 10, 2008
  29. Stephen R. van den BergSep 10, 2008
  30. Linus TorvaldsSep 11, 2008
  31. Stephen R. van den BergSep 11, 2008
  32. Jakub NarebskiSep 11, 2008
  33. Stephen R. van den BergSep 11, 2008
  34. Theodore TsoSep 11, 2008
  35. Stephen R. van den BergSep 11, 2008
  36. Theodore TsoSep 11, 2008
  37. Stephen R. van den BergSep 11, 2008
  38. Nicolas PitreSep 11, 2008
  39. Stephen R. van den BergSep 11, 2008
  40. Nicolas PitreSep 11, 2008
  41. Stephen R. van den BergSep 11, 2008
  42. Jakub NarebskiSep 11, 2008
  43. Stephen R. van den BergSep 11, 2008
  44. A Large Angry SCMSep 12, 2008
  45. Stephen R. van den BergSep 12, 2008
  46. Theodore TsoSep 11, 2008
  47. Jeff KingSep 11, 2008
  48. Stephen R. van den BergSep 11, 2008
  49. Jeff KingSep 11, 2008
  50. Stephen R. van den BergSep 11, 2008
  51. Linus TorvaldsSep 11, 2008
  52. Jeff KingSep 11, 2008
  53. Stephen R. van den BergSep 11, 2008
  54. Nicolas PitreSep 11, 2008
  55. Stephen R. van den BergSep 11, 2008
  56. Nicolas PitreSep 11, 2008
  57. Stephen R. van den BergSep 11, 2008
  58. Nicolas PitreSep 11, 2008
  59. Junio C HamanoSep 11, 2008
  60. Stephen R. van den BergSep 11, 2008
  61. Stephen R. van den BergSep 11, 2008
  62. A Large Angry SCMSep 11, 2008
  63. Stephen R. van den BergSep 11, 2008
  64. A Large Angry SCMSep 12, 2008
  65. Stephen R. van den BergSep 12, 2008
  66. Linus TorvaldsSep 11, 2008
  67. Paolo BonziniSep 11, 2008
  68. Linus TorvaldsSep 11, 2008
  69. Stephen R. van den BergSep 11, 2008
  70. Jakub NarebskiSep 11, 2008
  71. Stephen R. van den BergSep 11, 2008
  72. Nicolas PitreSep 11, 2008
  73. Stephen R. van den BergSep 11, 2008
  74. Nicolas PitreSep 11, 2008
  75. Stephen R. van den BergSep 12, 2008
  76. Theodore TsoSep 11, 2008
  77. Stephen R. van den BergSep 12, 2008
  78. Paolo BonziniSep 10, 2008
  79. Linus TorvaldsSep 10, 2008
  80. Paolo BonziniSep 10, 2008
  81. Linus TorvaldsSep 10, 2008
  82. Linus TorvaldsSep 10, 2008
  83. Paolo BonziniSep 10, 2008
  84. Stephen R. van den BergSep 10, 2008
  85. Jakub NarebskiSep 10, 2008
  86. Sam VilainSep 11, 2008
  87. Linus TorvaldsSep 11, 2008
  88. Sam VilainSep 12, 2008
  89. Stephen R. van den BergSep 12, 2008
  90. Rogan DawesSep 12, 2008
  91. Stephen R. van den BergSep 12, 2008
  92. Theodore TsoSep 12, 2008
  93. Paolo BonziniSep 12, 2008
  94. Jakub NarebskiSep 12, 2008
  95. Paolo BonziniSep 12, 2008
  96. Theodore TsoSep 12, 2008
  97. Stephen R. van den BergSep 12, 2008
  98. Jeff KingSep 12, 2008
  99. Stephen R. van den BergSep 12, 2008
  100. Theodore TsoSep 12, 2008
  101. Stephen R. van den BergSep 12, 2008
  102. Sam VilainSep 15, 2008
  103. Jakub NarebskiSep 9, 2008
  104. Petr BaudisSep 9, 2008
  105. Stephen R. van den BergSep 9, 2008
  106. Petr BaudisSep 9, 2008
  107. Stephen R. van den BergSep 9, 2008
  108. Paolo BonziniSep 10, 2008
  109. Petr BaudisSep 10, 2008
  110. Stephen R. van den BergSep 10, 2008
  111. Petr BaudisSep 10, 2008
  112. Stephen R. van den BergSep 10, 2008
  113. Dmitry PotapovSep 10, 2008
  114. Stephen R. van den BergSep 10, 2008
  115. Paolo BonziniSep 10, 2008
  116. Theodore TsoSep 10, 2008
  117. Stephen R. van den BergSep 10, 2008
  118. Jeff KingSep 10, 2008
  119. Stephen R. van den BergSep 10, 2008
  120. Jeff KingSep 10, 2008
  121. Stephen R. van den BergSep 10, 2008
  122. Jeff KingSep 10, 2008
  123. Stephen R. van den BergSep 10, 2008
  124. Paolo BonziniSep 11, 2008
  125. Stephen R. van den BergSep 11, 2008
  126. Paolo BonziniSep 11, 2008
  127. A Large Angry SCMSep 11, 2008
  128. Nicolas PitreSep 11, 2008
  129. Theodore TsoSep 10, 2008
  130. Petr BaudisSep 10, 2008
  131. Paolo BonziniSep 10, 2008
  132. Stephen R. van den BergSep 10, 2008
  133. Paolo BonziniSep 10, 2008
  134. Recording "partial merges" (was: Re: [RFC] origin link for cherry-pick and revert)Peter Krefting, Sep 23, 2008
  135. Miklos VajnaSep 10, 2008
  136. Nicolas PitreSep 10, 2008
  137. Miklos VajnaSep 10, 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.