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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 4, 2008, 19:59 UTC
Message-ID
<7vbq6wjxx1.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<30e4a070802040924g550671ccsb11108c71c99e378@mail.gmail.com>
"Mark Levedahl" <mlevedahl@gmail.com> writes:
> BIG difference here:
> $HOME = <name> of home directory, <name> is arbitrary. Files there are
> found as $HOME/<foo> or <name>/foo, they are the same, and I am free
> to set HOME=<arbitrary name>.
I think you misunderstood Dscho's $HOME analogy.

For example, the value of HOME environment variable is used as a shorthand to where you go to when you say

	$ cd

Everybody is happy that the variable is called HOME, and nobody would complain that the shell does not have another mechanism to let you have this in your .bashrc

	#!/bin/bash
	HOMEENVVAR=BASE
	BASE=/home/mark
        export HOMEENVVAR BASE

and make the parameterless "cd" honor the environment variable named with HOMEENVVER (in this case, BASE) instead.

Remote shorthand is exactly like a variable name. We say "git pull origin" and do not say "git pull $origin", but that is just a syntax issue. And "git pull" and friends are defined to default to the value of the origin 'variable' exactly like "cd" is defined to default to the value of the HOME variable.

I would agree 100% with Dscho on this point, if we did not have "clone -o".

"clone -o" is like the above HOMEENVVAR variable. It lets you rename what name other than origin is used to name what the origin 'variable' usually names, or at least pretends to let you do so. But its effect may not extend far enough and if there is such inconsistency, that is a bug worth fixing. For example, I think "git fetch" is Ok for basic use, because "clone -o" writes branch.master.remote in .git/config that points to the name you gave instead of 'origin', but there may be places that do use hardwired 'origin' and nothing else.

And that is the only reason I am still responding to this thread.

If a supermodule wants a specific remote to be used in a submodule, it should not default to 'origin' but it should name that specific remote explicitly. Even if we added the mechanism that looks like HOMEENVVAR to tell commands other than "git fetch" to default to something other than 'origin', I do not think such a use of submodule should depend on that fallback. I still haven't dismissed Dscho's argument that submodule related issues should be handled inside git-submodule for that reason.

We could remove support for "clone -o" and consistently use 'origin' as the default everywhere and completely remove the half-baked HOMEENVVAR lookalike. I do not think such a move is a good idea, but the point is that the solution to your submodule problem should work even if we did so. If the supermodule and a set of submodules are configured to use a specific remote that is not 'origin', it should use that specific remote by _naming_ it, not relying on where the fallback value is taken by other unrelated parts of the system, no?

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 14 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.