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

Re: [PATCH] git-submodule - allow a relative path as the subproject url

From
MSMichael Smith <msmith@cbnco.com>
Date
Sep 24, 2007, 00:21 UTC
Message-ID
<loom.20070924T002011-331@post.gmane.org>
In-Reply-To
<11904936042891-git-send-email-mdl123@verizon.net>
Mark Levedahl <mdl123 <at> verizon.net> writes:
> This allows a subproject's location to be specified and stored as relative
> to the parent project's location (e.g., ./foo, or ../foo). This url is
> stored in .gitmodules as given. 
> This allows cloning of the project to work "as expected" if the project
> is hosted on a different server than when the subprojects were added.
Hi Mark,

I have a use case where this would be very handy -- two teams geographically separated. But in the end I think I disagree with it: it's not up to me, as the person creating a superproject, to decide that anyone who forks or clones it also has to clone all the submodules.

Instead they can decide themselves by editing .git/config between "git submodule init" and "git submodule update", or by branching .gitmodules.

By the way:
Show 12 quoted lines
> +# Get parent project's url
> +get_parent_url ()
> +{
> +	# need to append this on parent project's url
> +	branch="$(git branch --no-color | sed -ne 's/^\* //p')"
> +	test -n "$branch" || die "I do not know what branch you are on: $branch"
> +	upstream="$(git config branch.$branch.remote)"
> +	test -n "$upstream" || die "Cannot find upstream repo for branch $branch"
> +	uprepo="$(git config remote.$upstream.url)"
> +	test -n "$upstream" || die "Cannot find url for repo $uprepo"
> +	echo "$uprepo"
> +}
...
> +	case $repo in
> +	.*)
> +		realrepo="$(get_parent_url)/$repo" ;;
If you source git-parse-remote, you can use
                realrepo="$(get_remote_url "$(get_default_remote)")$repo"
Mike
Previous: Mark LevedahlNext: Mark Levedahl
Message 2 of 5 in “git-submodule - allow a relative path as the subproject url”
  1. git-submodule - allow a relative path as the subproject urlMark Levedahl, Sep 22, 2007
  2. Michael SmithSep 24, 2007
  3. Mark LevedahlSep 24, 2007
  4. git-submodule - allow a relative path as the subproject urlMark Levedahl, Sep 24, 2007
  5. Junio C HamanoSep 25, 2007

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.