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

[PATCH 0 of 7] [resend] - Improve handling remotes, origin, submodules

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Feb 3, 2008, 17:31 UTC
Message-ID
<1202059867-1184-1-git-send-email-mlevedahl@gmail.com>

(sigh, someday I'll get this command line email addressing stuff sorted out - resending as I mangled Junio's email)

This patch series was inspired by several issues dealing with multiple remotes and submodules. The tests added as the last patch demonstrate the specific use pattern to be supported, and that does not work currently.

1 - user A creates a project on server "frotz" with a submodule. 2 - user B clones the project, forks it, adds a submodule, and publishes the fork on server "fork"

user A adds the fork to his working tree, via git remote add + git fetch. The desire is that: 1 - git submodule init + git submodule update include the new submdule added in the fork. 2 - The top-level project and all submodules use the same remote nickname to refer to the same server.

Breakage in 1.5.4 without this patch series is in several places:

1 - git submodule does not follow the top-level project's branch.<name>.remote in fetching, so does not try to clone the new submodule from remoe "fork" where the fork exists. 2 - If 1 were fixed, git submodule still invokes clone without "-o <remotenick>" when cloning, so each submodule would have "origin" point to a different remote. 3 - If 2 were fixed, submodule update leaves submodules on detached heads, so the remotes machinery cannot supply a remote name, and thus "origin" is used for further updates. As origin may not be defined, (e.g., for the submodule fetched from "fork" this also fails.)

The underlying design issue is the assumption that all projects revolve around a single server, so that *the* server can be called "origin" without confusion. Given a project with multiple servers and no one server being *the* server, origin cannot be usefully defined. Absent submodules, the remotes machinery largely masks this: origin is referred to only as the default remote and it is easy to avoid using the default remote. With submodules, this becomes more of an issue.

Following this patch series, the following is true:
1) The existing workflow of top-level and all sub-modules always
cloned from and interacting with a single default remote
nick-named "origin" is unchanged.
2) Via clone -o <nick> (or git confit core.origin <nick>), the
default remote is changed from origin to <nick>, and that default
is used instead of origin everywhere.
3) git-submodule uses the top-level's branch.<name>.remote to
choose which remote to fetch from, uses that in all submodules,
including defining that in existing submodules whose url is
relative (../* or ./*) indicating the submodule is maintained on
same server as top-level.

The penultimate patch addresses a basic usability issue, allowing addition of a submodule in place in a project, rather than requiring it be cloned from a remote. This hole in the porcelain became evident in creating a test (t7401) for this series. submodules except by cloning).

Next: Mark Levedahl
Message 1 of 19 in “[resend] - Improve handling remotes, origin, submodules”
  1. [resend] - Improve handling remotes, origin, submodulesMark Levedahl, Feb 3, 2008
  2. 1/7 Teach remote machinery about core.origin config variableMark Levedahl, Feb 3, 2008
  3. 2/7 git-remote - Unset core.origin when deleting the default remoteMark Levedahl, Feb 3, 2008
  4. 3/7 git-clone - Set remotes.origin config variableMark Levedahl, Feb 3, 2008
  5. 4/7 git-submodule - Possibly inherit parent's default remote on init/cloneMark Levedahl, Feb 3, 2008
  6. 5/7 Teach git-submodule to use top-level remote when updating subprojectsMark Levedahl, Feb 3, 2008
  7. 6/7 git-submodule - Allow adding a submodule in-placeMark Levedahl, Feb 3, 2008
  8. 7/7 Add t/t7401 - test submodule interaction with remotes machineryMark Levedahl, Feb 3, 2008
  9. Johannes SchindelinFeb 3, 2008
  10. Mark LevedahlFeb 4, 2008
  11. Johannes SchindelinFeb 4, 2008
  12. Mark LevedahlFeb 4, 2008
  13. Johannes SchindelinFeb 4, 2008
  14. Junio C HamanoFeb 4, 2008
  15. Johannes SchindelinFeb 4, 2008
  16. Junio C HamanoFeb 4, 2008
  17. Johannes SchindelinFeb 4, 2008
  18. Steffen ProhaskaFeb 4, 2008
  19. Johannes SchindelinFeb 4, 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.