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

Re: [PATCH] Teach remote machinery about remotes.default config variable

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Jan 15, 2008, 04:55 UTC
Message-ID
<478C3CD3.6010504@gmail.com>
In-Reply-To
<7vabn9m30a.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 15 quoted lines
> Mark Levedahl <mlevedahl@gmail.com> writes:
>
>   
>> ... if what
>> we need to fetch from is in fact not origin (even though the master
>> project knows what server to access), submodule update in fact doesn't
>> even work ...
>>     
>
> This is an interesting point.
>
> Perhaps git-submodule.sh::modules_update should use $url it
> obtains from the configuration in the upper level when running
> git-fetch in the submodule.
>   

yes, I like this change, it works very nicely. but that last patch is only a partial solution...

Show 9 quoted lines
> If you view the problem this way, your earlier "git fetch while
> the HEAD is detached always uses 'origin'" may turn out to be a
> non-issue.
>
> Which again brings us back to Johannes's earlier point.  If the
> issue is about submodule, maybe what needs to be fixes is in
> git-submodule, and not the defaulting to 'origin' git-fetch and
> friends do.
>   

Nope, git submodule *still* requires origin (e.g., execute git submodule init or update on a detached head). We are dancing around the issue, not fixing the root cause. This is perhaps illuminated by splitting projects into two camps:

Camp1 - there is no need to distinguish the upstream servers (or there is only one), calling it/all origin is fine. Camp2 - there is a need to distinguish servers, they are not identical, uniform naming across project is required (but folks might still like to be able to have a default, and probably want to change that default on occasion), .

So far, git is written as if the whole world is in Camp1, and the problems appear for Camp2. The underlying issue is that git has convolved the referencing, naming, and designation of a default remote into *one* thing when it is really three things. For git, the default remote is named origin, which is also how it is designated as the default, and is also how you reference the default in commands. Non-default remotes have an arbitrary nickname, are not default as they are not called origin, and are referenced by using their nicknames.

To serve Camp2 (and not impact Camp1), origin should be a handle that dereferences to the name of the default remote, and designation of the default remote should be by a separate config item rather than a special name for the remote. Assume core.origin names the default remote:

For Campl, we have
    core.origin=origin
with the default remote having nickname origin.
For Camp2, we could have
    core.origin=<whatever>
with the default remote having nickname <whatever>

At the command line, "git fetch" dereferences to $(git config core.origin), which is origin for Camp1, but <whatever> for Camp2. So, Camp1 users don't notice anything is different, and Camp2 users don't have a number of different servers all referred to as "origin".

The key is that in Camp2, a given remote now can have the *same* nickname for all members of the project, regardless of which remote they have made their default. "git fetch" and "git fetch origin" still work, they just dereference core.origin (perhaps verbosely to warn that the remote being updated is *not* actually named origin), then update the remotes/$(git config core.origin)/* branches.

Obviously, Camp1 with core.origin=origin is the default, and everything in user land works exactly as it does today. Camp2 with core.origin~=default is only mentioned in the graduate level git course and shielded with "Caution, Sharp Knives!" signs. Fine, I need the knives.

Mark
Previous: Junio C HamanoNext: Junio C Hamano
Message 21 of 134 in “Allowing override of the default "origin" nickname”
  1. Mark LevedahlJan 11, 2008
  2. Teach remote machinery about remotes.default config variableMark Levedahl, Jan 11, 2008
  3. git-remote - Unset remotes.default when deleting the default remoteMark Levedahl, Jan 11, 2008
  4. git-clone - Set remotes.default config variableMark Levedahl, Jan 11, 2008
  5. git-submodule - Possibly inherit parent's default remote on init/cloneMark Levedahl, Jan 11, 2008
  6. Junio C HamanoJan 11, 2008
  7. Mark LevedahlJan 11, 2008
  8. Junio C HamanoJan 12, 2008
  9. Mark LevedahlJan 12, 2008
  10. Junio C HamanoJan 12, 2008
  11. Mark LevedahlJan 12, 2008
  12. Junio C HamanoJan 12, 2008
  13. Mark LevedahlJan 12, 2008
  14. Junio C HamanoJan 12, 2008
  15. Mark LevedahlJan 12, 2008
  16. Johannes SchindelinJan 12, 2008
  17. Mark LevedahlJan 12, 2008
  18. Johannes SchindelinJan 13, 2008
  19. Mark LevedahlJan 14, 2008
  20. Junio C HamanoJan 14, 2008
  21. Mark LevedahlJan 15, 2008
  22. Junio C HamanoJan 15, 2008
  23. Mark LevedahlJan 15, 2008
  24. Johannes SchindelinJan 16, 2008
  25. Mark LevedahlJan 16, 2008
  26. Johannes SchindelinJan 16, 2008
  27. Junio C HamanoJan 12, 2008
  28. Mark LevedahlJan 12, 2008
  29. Junio C HamanoJan 12, 2008
  30. Mark LevedahlJan 13, 2008
  31. Teach remote machinery about core.origin config variableMark Levedahl, Jan 13, 2008
  32. git-remote - Unset core.origin when deleting the default remoteMark Levedahl, Jan 13, 2008
  33. git-clone - Set remotes.origin config variableMark Levedahl, Jan 13, 2008
  34. git-submodule - Possibly inherit parent's default remote on init/cloneMark Levedahl, Jan 13, 2008
  35. Teach git-submodule to use master's remote when updating subprojectsMark Levedahl, Jan 13, 2008
  36. Jeff KingJan 14, 2008
  37. Mark LevedahlJan 15, 2008
  38. Jeff KingJan 15, 2008
  39. Johannes SchindelinJan 13, 2008
  40. Junio C HamanoJan 14, 2008
  41. safecrlf not in 1.5.4 (was Re: [PATCH] Teach remote machinery about remotes.default config variable)Steffen Prohaska, Jan 14, 2008
  42. Johannes SchindelinJan 14, 2008
  43. valgrind test scripts (was Re: [PATCH] Teach remote...)Jeff King, Jan 14, 2008
  44. What's not in 'master' but should beJunio C Hamano, Jan 18, 2008
  45. Lars HjemliJan 18, 2008
  46. Junio C HamanoJan 18, 2008
  47. Lars HjemliJan 18, 2008
  48. Junio C HamanoJan 18, 2008
  49. Lars HjemliJan 18, 2008
  50. Johannes SchindelinJan 18, 2008
  51. Lars HjemliJan 18, 2008
  52. Junio C HamanoJan 18, 2008
  53. What's not in 'master', and likely not to be until 1.5.4Junio C Hamano, Jan 18, 2008
  54. Johannes SixtJan 18, 2008
  55. Junio C HamanoJan 18, 2008
  56. Steffen ProhaskaJan 18, 2008
  57. Johannes SchindelinJan 18, 2008
  58. Johannes SchindelinJan 18, 2008
  59. Johannes SchindelinJan 18, 2008
  60. Shawn O. PearceJan 21, 2008
  61. Johannes SchindelinJan 21, 2008
  62. Shawn O. PearceJan 23, 2008
  63. Johannes SchindelinJan 23, 2008
  64. Johannes SixtJan 18, 2008
  65. Johannes SchindelinJan 18, 2008
  66. Jakub NarebskiJan 18, 2008
  67. Junio C HamanoJan 18, 2008
  68. Imran M YousufJan 21, 2008
  69. Junio C HamanoJan 21, 2008
  70. Steffen ProhaskaJan 21, 2008
  71. submodule: Document the details of the command line syntaxSteffen Prohaska, Jan 21, 2008
  72. Junio C HamanoJan 21, 2008
  73. Marco CostalbaJan 18, 2008
  74. Marco CostalbaJan 18, 2008
  75. Steffen ProhaskaJan 18, 2008
  76. Johannes SchindelinJan 18, 2008
  77. Steffen ProhaskaJan 18, 2008
  78. What's not in 'master', and likely not to be in, until 1.5.4Junio C Hamano, Jan 21, 2008
  79. Linus TorvaldsJan 21, 2008
  80. Junio C HamanoJan 21, 2008
  81. Junio C HamanoJan 21, 2008
  82. Junio C HamanoJan 21, 2008
  83. Junio C HamanoJan 21, 2008
  84. Junio C HamanoJan 21, 2008
  85. Junio C HamanoJan 21, 2008
  86. 1/2 read-cache.c: introduce is_racy_timestamp() helperJunio C Hamano, Jan 21, 2008
  87. 2/2 read-cache.c: fix timestamp comparisonJunio C Hamano, Jan 21, 2008
  88. Linus TorvaldsJan 21, 2008
  89. Johannes SchindelinJan 21, 2008
  90. Linus TorvaldsJan 21, 2008
  91. Linus TorvaldsJan 21, 2008
  92. Johannes SchindelinJan 21, 2008
  93. Linus TorvaldsJan 21, 2008
  94. Junio C HamanoJan 21, 2008
  95. Linus TorvaldsJan 21, 2008
  96. Junio C HamanoJan 21, 2008
  97. Junio C HamanoJan 22, 2008
  98. Linus TorvaldsJan 22, 2008
  99. Linus TorvaldsJan 22, 2008
  100. Junio C HamanoJan 23, 2008
  101. Linus TorvaldsJan 23, 2008
  102. Johannes SixtJan 21, 2008
  103. Daniel BarkalowJan 21, 2008
  104. Marco CostalbaJan 21, 2008
  105. Johannes SchindelinJan 18, 2008
  106. Johannes SchindelinJan 18, 2008
  107. Johannes SchindelinFeb 18, 2008
  108. Mike HommeyJan 19, 2008
  109. Grégoire BarbierJan 19, 2008
  110. Johannes SchindelinJan 19, 2008
  111. Johannes SchindelinJan 12, 2008
  112. Mark LevedahlJan 12, 2008
  113. Johannes SchindelinJan 12, 2008
  114. Teach remote machinery about core.origin config variableMark Levedahl, Jan 12, 2008
  115. git-remote - Unset core.origin when deleting the default remoteMark Levedahl, Jan 12, 2008
  116. git-clone - Set remotes.origin config variableMark Levedahl, Jan 12, 2008
  117. git-submodule - Possibly inherit parent's default remote on init/cloneMark Levedahl, Jan 12, 2008
  118. Johannes SchindelinJan 11, 2008
  119. Mark LevedahlJan 11, 2008
  120. Johannes SchindelinJan 11, 2008
  121. Mark LevedahlJan 11, 2008
  122. Johannes SchindelinJan 11, 2008
  123. Mark LevedahlJan 11, 2008
  124. Björn SteinbrinkJan 11, 2008
  125. Jakub NarebskiJan 11, 2008
  126. Jakub NarebskiJan 11, 2008
  127. Mark LevedahlJan 11, 2008
  128. Johannes SchindelinJan 11, 2008
  129. Daniel BarkalowJan 11, 2008
  130. Junio C HamanoJan 14, 2008
  131. Steffen ProhaskaJan 14, 2008
  132. Junio C HamanoJan 14, 2008
  133. Dmitry PotapovJan 14, 2008
  134. Pierre HabouzitJan 14, 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.