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

Re: [PATCH 3/2] merge-trees script for Linus git

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 16, 2005, 15:28 UTC
Message-ID
<Pine.LNX.4.58.0504160820320.7211@ppc970.osdl.org>
In-Reply-To
<7vis2ncf8j.fsf@assigned-by-dhcp.cox.net>
On Sat, 16 Apr 2005, Junio C Hamano wrote:
Show 6 quoted lines
> 
> LT> NOTE NOTE NOTE! I could make "read-tree" do some of these nontrivial 
> LT> merges, but I ended up deciding that only the "matches in all three 
> LT> states" thing collapses by default.
> 
>  * Understood and agreed.

Having slept on it, I think I'll merge all the trivial cases that don't involve a file going away or being added. Ie if the file is in all three trees, but it's the same in two of them, we know what to do.

That way we'll leave thigns where the tree itself changed (files added or removed at any point) and/or cases where you actually need a 3-way merge.

> The userland merge policies need ways to extract the stage
> information and manipulate them.  Am I correct to say that you
> mean by "ls-files -l" the extracting part?

No, I meant "show-files", since we need to show the index, not a tree (no valid tree can ever have the "modes" information, since (a) it doesn't have the space for it anyway and (b) we refuse to write out a dirty index file.

Show 13 quoted lines
> 
> LT> I should make "ls-files" have a "-l" format, which shows the
> LT> index and the mode for each file too.
> 
> You probably meant "ls-tree".  You used the word "mode" but it
> already shows the mode so I take it to mean "stage".  Perhaps
> something like this?
> 
> $ ls-tree -l -r 49c200191ba2e3cd61978672a59c90e392f54b8b
> 100644	blob	fe2a4177a760fd110e78788734f167bd633be8de	COPYING
> 100644	blob	b39b4ea37586693dd707d1d0750a9b580350ec50:1	man/frotz.6
> 100644	blob	b39b4ea37586693dd707d1d0750a9b580350ec50:2	man/frotz.6
> 100664	blob	eeed997e557fb079f38961354473113ca0d0b115:3	man/frotz.6
Apart from the fact that it would be
	show-files -l

since there are no tree objects that can have anything but fully merged state, yes.

Show 39 quoted lines
> Assuming that you would be working on that, I'd like to take the
> dircache manipulation part.  Let's think about the minimally
> necessary set of operations:
> 
>  * The merge policy decides to take one of the existing stage.
> 
>    In this case we need a way to register a known mode/sha1 at a
>    path.  We already have this as "update-cache --cacheinfo".
>    We just need to make sure that when "update-cache" puts
>    things at stage 0 it clears other stages as well.
> 
>  * The merge policy comes up with a desired blob somewhere on
>    the filesystem (perhaps by running an external merge
>    program).  It wants to register it as the result of the
>    merge.
> 
>    We could do this today by first storing the "desired blob"
>    in a temporary file somewhere in the path the dircache
>    controls, "update-cache --add" the temporary file, ls-tree to
>    find its mode/sha1, "update-cache --remove" the temporary
>    file and finally "update-cache --cacheinfo" the mode/sha1.
>    This is workable but clumsy.  How about:
> 
>    $ update-cache --graft [--add] desired-blob path
> 
>    to say "I want to register mode/sha1 from desired-blob, which
>    may not be of verify_path() satisfying name, at path in the
>    dircache"?
> 
>  * The merge policy decides to delete the path.
> 
>    We could do this today by first stashing away the file at the
>    path if it exists, "update-cache --remove" it, and restore
>    if necessary.  This is again workable but clumsy.  How about:
> 
>    $ update-cache --force-remove path
> 
>    to mean "I want to remove the path from dircache even though
>    it may exist in my working tree"?
Yes.
> Am I on the right track?
Exactly.
Show 7 quoted lines
> You might want to go even lower level by letting them say
> something like:
> 
>  * update-cache --register-stage mode sha1 stage path
> 
>    Registers the mode/sha1 at stage for path.  Does not look at
>    the working tree.  stage is [0-3]

I'd prefer not. I'd avoid playing games with the stages at any other level than the "full tree" level until we show a real need for it.

Let's go with the known-needed minimal cases that are high-level enough to make the scripting simple, and see if there is any reason to ever touch the tree any other way.

		Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 128 of 130 in “Merge with git-pasky II.”
  1. Petr BaudisApr 14, 2005
  2. Christopher LiApr 13, 2005
  3. Petr BaudisApr 14, 2005
  4. Christopher LiApr 13, 2005
  5. Linus TorvaldsApr 14, 2005
  6. Christopher LiApr 14, 2005
  7. Paul JacksonApr 14, 2005
  8. Christopher LiApr 14, 2005
  9. Paul JacksonApr 14, 2005
  10. Junio C HamanoApr 14, 2005
  11. Linus TorvaldsApr 14, 2005
  12. Junio C HamanoApr 14, 2005
  13. Linus TorvaldsApr 14, 2005
  14. Junio C HamanoApr 14, 2005
  15. Petr BaudisApr 14, 2005
  16. Junio C HamanoApr 14, 2005
  17. Linus TorvaldsApr 14, 2005
  18. Junio C HamanoApr 14, 2005
  19. Petr BaudisApr 14, 2005
  20. Linus TorvaldsApr 15, 2005
  21. Barry SilvermanApr 15, 2005
  22. David WoodhouseApr 15, 2005
  23. Linus TorvaldsApr 15, 2005
  24. David WoodhouseApr 15, 2005
  25. C. Scott AnanianApr 15, 2005
  26. Linus TorvaldsApr 15, 2005
  27. Johannes SchindelinApr 16, 2005
  28. David WoodhouseApr 17, 2005
  29. Paul JacksonApr 15, 2005
  30. Simon FowlerApr 16, 2005
  31. David LangApr 16, 2005
  32. Simon FowlerApr 16, 2005
  33. Petr BaudisApr 16, 2005
  34. Simon FowlerApr 16, 2005
  35. Linus TorvaldsApr 16, 2005
  36. David LangApr 16, 2005
  37. Ingo MolnarApr 17, 2005
  38. Brad RobertsApr 17, 2005
  39. Ingo MolnarApr 17, 2005
  40. Ingo MolnarApr 17, 2005
  41. Linus TorvaldsApr 17, 2005
  42. Herbert XuApr 17, 2005
  43. Linus TorvaldsApr 17, 2005
  44. Herbert XuApr 17, 2005
  45. Petr BaudisApr 17, 2005
  46. Kenneth JohanssonApr 17, 2005
  47. Herbert XuApr 18, 2005
  48. Petr BaudisApr 18, 2005
  49. Linus TorvaldsApr 17, 2005
  50. Sanjoy MahajanApr 18, 2005
  51. Ingo MolnarApr 18, 2005
  52. Sanjoy MahajanApr 16, 2005
  53. Linus TorvaldsApr 16, 2005
  54. ls-tree enhancementsJunio C Hamano, Apr 15, 2005
  55. Petr BaudisApr 15, 2005
  56. Junio C HamanoApr 15, 2005
  57. David WoodhouseApr 15, 2005
  58. Ingo MolnarApr 15, 2005
  59. David WoodhouseApr 15, 2005
  60. Ingo MolnarApr 15, 2005
  61. David WoodhouseApr 15, 2005
  62. Johannes SchindelinApr 15, 2005
  63. Theodore Ts'oApr 15, 2005
  64. Linus TorvaldsApr 15, 2005
  65. David WoodhouseApr 15, 2005
  66. Linus TorvaldsApr 15, 2005
  67. Paul JacksonApr 15, 2005
  68. C. Scott AnanianApr 15, 2005
  69. Paul JacksonApr 15, 2005
  70. Christopher LiApr 14, 2005
  71. Petr BaudisApr 14, 2005
  72. Live Merging from remote repositoriesBarry Silverman, Apr 14, 2005
  73. Junio C HamanoApr 14, 2005
  74. Question about git process modelBarry Silverman, Apr 15, 2005
  75. Erik van KonijnenburgApr 14, 2005
  76. Petr BaudisApr 14, 2005
  77. Junio C HamanoApr 14, 2005
  78. Christopher LiApr 14, 2005
  79. Petr BaudisApr 14, 2005
  80. Christopher LiApr 14, 2005
  81. Christopher LiApr 14, 2005
  82. Christopher LiApr 14, 2005
  83. Junio C HamanoApr 15, 2005
  84. Christopher LiApr 14, 2005
  85. Junio C HamanoApr 15, 2005
  86. Christopher LiApr 15, 2005
  87. Junio C HamanoApr 15, 2005
  88. Petr BaudisApr 15, 2005
  89. Junio C HamanoApr 15, 2005
  90. Petr BaudisApr 15, 2005
  91. Junio C HamanoApr 15, 2005
  92. Junio C HamanoApr 15, 2005
  93. Linus TorvaldsApr 15, 2005
  94. Petr BaudisApr 14, 2005
  95. git mergePetr Baudis, Apr 14, 2005
  96. Linus TorvaldsApr 15, 2005
  97. Petr BaudisApr 15, 2005
  98. Linus TorvaldsApr 15, 2005
  99. Petr BaudisApr 15, 2005
  100. Linus TorvaldsApr 16, 2005
  101. Daniel BarkalowApr 16, 2005
  102. Linus TorvaldsApr 16, 2005
  103. Daniel BarkalowApr 16, 2005
  104. Linus TorvaldsApr 16, 2005
  105. Daniel BarkalowApr 16, 2005
  106. Paul JacksonApr 16, 2005
  107. Petr BaudisApr 16, 2005
  108. Junio C HamanoApr 15, 2005
  109. C. Scott AnanianApr 15, 2005
  110. Petr BaudisApr 15, 2005
  111. Junio C HamanoApr 15, 2005
  112. 1/2 merge-trees script for Linus gitJunio C Hamano, Apr 15, 2005
  113. 2/2 merge-trees script for Linus gitJunio C Hamano, Apr 15, 2005
  114. 3/2 merge-trees script for Linus gitJunio C Hamano, Apr 15, 2005
  115. Linus TorvaldsApr 16, 2005
  116. Junio C HamanoApr 16, 2005
  117. Linus TorvaldsApr 16, 2005
  118. Linus TorvaldsApr 16, 2005
  119. Junio C HamanoApr 16, 2005
  120. Byteorder fix for read-tree, new -m semantics version.Junio C Hamano, Apr 16, 2005
  121. 1/2 Add --stage to show-files for new stage dircache.Junio C Hamano, Apr 16, 2005
  122. 2/2 Add --stage to show-files for new stage dircache.Junio C Hamano, Apr 16, 2005
  123. Issues with higher-order stages in dircacheJunio C Hamano, Apr 16, 2005
  124. Junio C HamanoApr 17, 2005
  125. Linus TorvaldsApr 17, 2005
  126. Junio C HamanoApr 17, 2005
  127. Summary of "read-tree -m O A B" mechanismJunio C Hamano, Apr 17, 2005
  128. Linus TorvaldsApr 16, 2005
  129. Linus TorvaldsApr 16, 2005
  130. Junio C HamanoApr 16, 2005

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.