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

Re: [PATCH 0/5] Fix 'url.*.insteadOf' for submodule URLs

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 4, 2008, 02:06 UTC
Message-ID
<7vwsix5y9w.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200808040147.16797.johan@herland.net>
Johan Herland <johan@herland.net> writes:
> 1. Consistency: Other git commands in the supermodule does _not_ require the 
> URL rewriting rule to reside in the global config. Why should 'git 
> submodule' be different.

When it comes to "submodules", I do not think such consistency argument makes much sense. "git submodule" command crosses module boundary, normal commands don't. They are naturally different and they should be.

Your kind of consistency means breaking the separation between module boundary, doesn't it?

Having said that...
> 2. I believe there are valid use cases for adding URL rewriting rules to the 
> repo config instead of the global config. You may want to check out Fred's 
> version of project X (including submodules), without making your other 
> clones of project X start cloning/fetching from Fred.

I think you are referring to the example given in an earlier thread to peek what your neighbor did between you two, without affecting other people.

Personally I think it is partly showing the shortcoming of the current "git submodule" that minimally supports the workflow to follow what the canonical repository does, and partly showing that it is an abuse of that interface to rewrite config file to temporarily switch to peek somewhere else in such a workflow.

Let's step back and think what we would do if there is no submodule involved. That is, you usually follow origin, but you temporarily want to peek at what Fred did. How would you do this?

	$ git fetch $fred $branch_fred_wants_you_to_review
        $ git checkout FETCH_HEAD ;# this detaches HEAD.

And you take a look around. Perhaps you like the change and decide to merge that to your branch. Perhaps you create your own branch on top of that state, build a few fix-up commits, and give the result back to Fred.

Shouldn't peeking what Fred did in the whole submodule hierarchy be essentially the same thing? That is,

	$ git submodule for-each-submodule sh -c '
                git fetch "$fred/$1" $branch_fred_wants_you_to_review &&
                git checkout FETCH_HEAD
	' -

where "for-each-submodule" would iterate over the submodules in the current superproject that you are interested in (that is, you actually have corresponding repositories there), and runs any given command with the path to the submodule in that directory.

Hmm?
Previous: Johan HerlandNext: Johan Herland
Message 10 of 12 in “Fix 'url.*.insteadOf' for submodule URLs”
  1. 0/5 Fix 'url.*.insteadOf' for submodule URLsJohan Herland, Aug 3, 2008
  2. 1/5 Add testcase for 'git submodule' with url.*.insteadOf set in the super-repoJohan Herland, Aug 3, 2008
  3. 1/5 Add testcase for 'git submodule' with url.*.insteadOf set in the super-repoJohan Herland, Aug 3, 2008
  4. 2/5 Teach 'git config' to rewrite URLs according to current url.*.insteadOf rulesJohan Herland, Aug 3, 2008
  5. 3/5 Add selftest for new option '--rewrite-url' to 'git config'Johan Herland, Aug 3, 2008
  6. 4/5 Add documentation on the new --rewrite-url option to 'git config'Johan Herland, Aug 3, 2008
  7. 5/5 Teach 'git submodule' to rewrite submodule URLs according to super-repo's rulesJohan Herland, Aug 3, 2008
  8. Johannes SchindelinAug 3, 2008
  9. Johan HerlandAug 3, 2008
  10. Junio C HamanoAug 4, 2008
  11. Johan HerlandAug 4, 2008
  12. Junio C HamanoAug 3, 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.