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

Re: [RFD PATCH 00/32] subtree clone v2

From
Elijah Newren <newren@gmail.com>
Date
Aug 25, 2010, 04:37 UTC
Message-ID
<AANLkTinsNvVup43B6nQtU6dvJy789n8kQm6N6na0J9oa@mail.gmail.com>
In-Reply-To
<AANLkTikipryFVf_XvvbHopWSo5Ey_mvgTevY2NAvhygQ@mail.gmail.com>
On Tue, Aug 24, 2010 at 4:47 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
Show 30 quoted lines
> On Wed, Aug 25, 2010 at 8:37 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Nguyễn Thái Ngọc Duy wrote:
>>
>>> Patches 26..30
>>>   Add upload-narrow-base command
>>>   rev-list: traverse some more trees to make upload-narrow-base happy
>>>   narrow-tree: add oldest_narrow_base()
>>>   Add command fetch-narrow-base
>>>   merge: support merging when narrow bases are different
>>>
>>> Remote merge part.
>>>
>>> Split a merge operation into two parts, the real merge will be done
>>> within narrow tree. Conflicts can happen and be resolved in the narrow
>>> index, locally.
>>>
>>> Everything outside narrow tree will be merged (trivially) by
>>> server. Then server sends the base tree back, so join_narrow_tree() in
>>> patch 20 can be used to create proper commit.
>>>
>>> Server can disable this remote merge feature, which means users are
>>> forced to do rebase/fast-forward. Not too bad.
>>
>> Yikes.  Naïve question (please forgive my laziness): is it possible to
>> merge without remote contact in the boring case, when no changes have
>> occured outside the narrow tree?
>
> That's possible (and is implemented in my series). But I guess as soon
> as you do "git pull", the boring case is likely not applicable
> anymore.

I'm not sure I follow. Are you allowing changes outside the narrow tree to occur? If you're not, I would have assumed that repeated pulls just work, without any need to talk to the server, using a resolve-like strategy (with no special rename detection).

Here's my understanding, though it might have holes:

If you have a narrow/subtree clone, it means that you only have the data for a certain paths. I'm assuming that also meant you would only allow modifying those paths. In other words, you have no changes outside the narrow tree. Because of that, I think you can handle paths outside the narrow region using trivial-merge logic: From Documentation/technical/trivial-merge.txt, I think the relevant cases are 2, 3, 8, 10, 13, or 14. 13 & 14 already have a specified resolution. There's already a comment in the file that cases 8 & 10 could validly be resolved as (empty), it just hasn't been done in the code as it tends to happen with the follow-up automatic merge anyway. That only leaves cases 2 & 3 as being slightly tricky -- if a path on one side of the merge started empty and ended empty, it would seem to make sense that the non-empty path on the other side would be the resolution. We can't do that in the non-narrow clone case because the non-empty path may have been created due to a rename and we'd like to have changes follow the rename appropriately. However, in the narrow clone case, one can't rename from a path you don't have to a path you do, so this possibility is eliminated.

So, if my understanding is correct, then if you have no changes from upstream outside the sparse/narrow/whatever paths (where "paths" currently means a single tree in your current patches), I think you should be able to do a merge locally in that sparse clone. The end result will also have no changes from upstream outside those paths. Thus, you should be able to merge again.

Does that seem reasonable?  Am I missing anything?
Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 54 of 66 in “subtree clone v2”
  1. 00/32 subtree clone v2Nguyễn Thái Ngọc Duy, Aug 24, 2010
  2. 01/32 add const to ce_write()Nguyễn Thái Ngọc Duy, Aug 24, 2010
  3. 02/32 cache-tree: abstract out write_sha1_file from cache_tree_update()Nguyễn Thái Ngọc Duy, Aug 24, 2010
  4. Jonathan NiederAug 24, 2010
  5. 03/32 cache-tree: ignore CE_REMOVE entries in verify_cache()Nguyễn Thái Ngọc Duy, Aug 24, 2010
  6. Jonathan NiederAug 24, 2010
  7. Nguyen Thai Ngoc DuyAug 25, 2010
  8. Jonathan NiederAug 25, 2010
  9. 04/32 move do_compress() from pack-objects.c to pack-write.cNguyễn Thái Ngọc Duy, Aug 24, 2010
  10. Jonathan NiederAug 24, 2010
  11. Nguyen Thai Ngoc DuyAug 25, 2010
  12. 05/32 pack-write: add functions for creating simple packsNguyễn Thái Ngọc Duy, Aug 24, 2010
  13. 06/32 tree.c: Add {set,clear}_tree_marksNguyễn Thái Ngọc Duy, Aug 24, 2010
  14. 07/32 tree.c: find_subtree() to search for a treeNguyễn Thái Ngọc Duy, Aug 24, 2010
  15. Elijah NewrenAug 25, 2010
  16. Nguyen Thai Ngoc DuyAug 25, 2010
  17. Elijah NewrenAug 25, 2010
  18. 08/32 Add $GIT_DIR/narrow checkNguyễn Thái Ngọc Duy, Aug 24, 2010
  19. 09/32 index: make narrow index incompatible with older gitNguyễn Thái Ngọc Duy, Aug 24, 2010
  20. Jonathan NiederAug 24, 2010
  21. Nguyen Thai Ngoc DuyAug 25, 2010
  22. 10/32 rev-list: support traversing in narrow repository modeNguyễn Thái Ngọc Duy, Aug 24, 2010
  23. Elijah NewrenAug 25, 2010
  24. 11/32 rev-list: support --narrow-treeNguyễn Thái Ngọc Duy, Aug 24, 2010
  25. Elijah NewrenAug 25, 2010
  26. Nguyen Thai Ngoc DuyAug 25, 2010
  27. 12/32 pack-objects: support --narrow-treeNguyễn Thái Ngọc Duy, Aug 24, 2010
  28. 13/32 upload-pack: support narrow-tree capabilityNguyễn Thái Ngọc Duy, Aug 24, 2010
  29. 14/32 fetch-pack: support --narrow-treeNguyễn Thái Ngọc Duy, Aug 24, 2010
  30. 15/32 unpack_trees: only unpack $GIT_DIR/narrow subtree in narrow repositoryNguyễn Thái Ngọc Duy, Aug 24, 2010
  31. Elijah NewrenAug 25, 2010
  32. Nguyen Thai Ngoc DuyAug 25, 2010
  33. 16/32 cache-tree: only cache tree within narrow areaNguyễn Thái Ngọc Duy, Aug 24, 2010
  34. 17/32 tree-diff: add narrow versions of diff_{root_,}tree_sha1Nguyễn Thái Ngọc Duy, Aug 24, 2010
  35. 18/32 log-tree: use narrow version of diff_tree_sha1Nguyễn Thái Ngọc Duy, Aug 24, 2010
  36. 19/32 clone: support --narrow optionNguyễn Thái Ngọc Duy, Aug 24, 2010
  37. 20/32 narrow-tree: add join_narrow_tree to do tree fixup for commitsNguyễn Thái Ngọc Duy, Aug 24, 2010
  38. 21/32 commit: add narrow's commit_tree versionNguyễn Thái Ngọc Duy, Aug 24, 2010
  39. 22/32 commit: use commit_narrow_tree() to support narrow repoNguyễn Thái Ngọc Duy, Aug 24, 2010
  40. 23/32 commit-tree: require --narrow-base in narrow repoNguyễn Thái Ngọc Duy, Aug 24, 2010
  41. 24/32 merge: refuse to merge if narrow bases are differentNguyễn Thái Ngọc Duy, Aug 24, 2010
  42. 25/32 merge: prepare commit properly in narrow modeNguyễn Thái Ngọc Duy, Aug 24, 2010
  43. 26/32 Add upload-narrow-base commandNguyễn Thái Ngọc Duy, Aug 24, 2010
  44. 27/32 rev-list: traverse some more trees to make upload-narrow-base happyNguyễn Thái Ngọc Duy, Aug 24, 2010
  45. 28/32 narrow-tree: add oldest_narrow_base()Nguyễn Thái Ngọc Duy, Aug 24, 2010
  46. 29/32 Add command fetch-narrow-baseNguyễn Thái Ngọc Duy, Aug 24, 2010
  47. 30/32 merge: support merging when narrow bases are differentNguyễn Thái Ngọc Duy, Aug 24, 2010
  48. 31/32 send-pack: do not use thin pack in narrow modeNguyễn Thái Ngọc Duy, Aug 24, 2010
  49. 32/32 daemon: support upload-narrow-baseNguyễn Thái Ngọc Duy, Aug 24, 2010
  50. Jonathan NiederAug 24, 2010
  51. Nguyen Thai Ngoc DuyAug 24, 2010
  52. Jonathan NiederAug 24, 2010
  53. Nguyen Thai Ngoc DuyAug 25, 2010
  54. Elijah NewrenAug 25, 2010
  55. Nguyen Thai Ngoc DuyAug 25, 2010
  56. Elijah NewrenAug 25, 2010
  57. Nguyen Thai Ngoc DuyAug 25, 2010
  58. Elijah NewrenAug 25, 2010
  59. Nguyen Thai Ngoc DuyAug 25, 2010
  60. Elijah NewrenAug 26, 2010
  61. Nguyen Thai Ngoc DuyAug 26, 2010
  62. Elijah NewrenAug 26, 2010
  63. Nguyen Thai Ngoc DuyAug 26, 2010
  64. Elijah NewrenAug 25, 2010
  65. Junio C HamanoAug 25, 2010
  66. Elijah NewrenAug 25, 2010

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.