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

Re: [PATCH 2/7] git-submodule: Extract absolute_url & move absolute url logic to module_clone

From
Ping Yin <pkufranky@gmail.com>
Date
Apr 22, 2008, 14:41 UTC
Message-ID
<46dff0320804220741p4d3f3080w493fb96dc4983a1c@mail.gmail.com>
In-Reply-To
<46dff0320804220738u760a05f7q4ec9cbf144d78480@mail.gmail.com>
On Tue, Apr 22, 2008 at 10:38 PM, Ping Yin <pkufranky@gmail.com> wrote:
Show 8 quoted lines
> >  >  Please have that kind of justification in the proposed commit log message.
>  >  >  When these changes are made into history, people cannot ask you questions
>  >  >  like I did and expect the history to produce such answer on demand ;-)
>  >  >
>  >
>  >  OK, i'll resend this patch tonight.
>
>  See attached patch
Only the commit message changes.
git-submodule: Fix inconsistent handling of relative urls with './' prefix

There is a little inconsistence in current handling of relative url with "./"

- "git submodule add ./foo" will clone the submodule with url
  "${remote.origin.url}/foo" and init an entry 'submodule.foo.url=./foo"
  in .gitmodules
- "git submodule init" will init an entry in $GIT_DIR/config as
  "submodule.foo.url=${remote.origin.url}/foo"
- However, if there is an entry "submodule.foo.url=./foo" in
  $GIT_DIR/config, "git submodule update" will not expand
  "./foo" with remote.origin.url

This patch unifies the behaviour of handling relative urls with './' prefix. Now "git submodule init" copies urls from .gitmodules to $GIT_DIR/config as is without expanding. And the url expanding happens only at runtime, say when "git submodule add" or "git submodule update".

absolute_url is extracted to remove code redundance and fix inconsistence in cmd_init and cmd_add when resolving relative url/path to absolute one.

Also move resolving absolute url logic from cmd_add to module_clone which results in the expected behaviour change: cmd_update will resolve url './foo' in $GIT_DIR/config as "${remote.origin.url}/foo" instead of "$(pwd)/foo".

This behaviour change breaks t7400 which uses relative url './.subrepo'. However, this test originally doesn't mean to test relative url with './' prefix, so fix the url as '.subrepo'.

-- 
Ping Yin
Previous: Ping YinNext: Ping Yin
Message 14 of 18 in “submodule: fallback to .gitmodules and multiple level module definition”
  1. 0/7 submodule: fallback to .gitmodules and multiple level module definitionPing Yin, Apr 16, 2008
  2. 1/7 git-submodule: Extract functions module_info and module_urlPing Yin, Apr 16, 2008
  3. 2/7 git-submodule: Extract absolute_url & move absolute url logic to module_clonePing Yin, Apr 16, 2008
  4. 3/7 git-submodule: Fall back on .gitmodules if info not found in $GIT_DIR/configPing Yin, Apr 16, 2008
  5. 4/7 git-submodule: Extract module_add from cmd_addPing Yin, Apr 16, 2008
  6. 5/7 git-submodule: multi-level module definitionPing Yin, Apr 16, 2008
  7. 6/7 git-submodule: "update --force" to enforce cloning non-submodulePing Yin, Apr 16, 2008
  8. 7/7 git-submodule: Don't die when command fails for one submodulePing Yin, Apr 16, 2008
  9. Junio C HamanoApr 22, 2008
  10. Ping YinApr 22, 2008
  11. Junio C HamanoApr 22, 2008
  12. Ping YinApr 22, 2008
  13. Ping YinApr 22, 2008
  14. Ping YinApr 22, 2008
  15. Ping YinApr 22, 2008
  16. Ping YinApr 22, 2008
  17. Jakub NarebskiApr 22, 2008
  18. Ping YinApr 22, 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.