All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Smith <msmith@cbnco.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] git-submodule - allow a relative path as the subproject url
Date: Mon, 24 Sep 2007 00:21:24 +0000 (UTC)	[thread overview]
Message-ID: <loom.20070924T002011-331@post.gmane.org> (raw)
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:

> +# 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

  reply	other threads:[~2007-09-24  0:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-22 20:40 [PATCH] git-submodule - allow a relative path as the subproject url Mark Levedahl
2007-09-24  0:21 ` Michael Smith [this message]
2007-09-24  2:27   ` Mark Levedahl
2007-09-24  2:19 ` Mark Levedahl
2007-09-25  6:42   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20070924T002011-331@post.gmane.org \
    --to=msmith@cbnco.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.