git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "W. Trevor King" <wking@tremily.us>
To: Charles Brossollet <chbrosso@lltech.fr>
Cc: Fredrik Gustafsson <iveqy@iveqy.com>, git@vger.kernel.org
Subject: Re: Re: Relative submodule URLs, and forks that haven't forked the submodule
Date: Thu, 12 Jun 2014 11:05:43 -0700	[thread overview]
Message-ID: <20140612180543.GA28801@odin.tremily.us> (raw)
In-Reply-To: <DF027A78-FAC4-4120-9259-1A3D84635BDB@lltech.fr>

[-- Attachment #1: Type: text/plain, Size: 1873 bytes --]

On Thu, Jun 12, 2014 at 06:05:10PM +0200, Charles Brossollet wrote:
> The two problems I'm pointing are:
> 
> 1. After checkout of a branch that tracks /user/main repo, call git
>    init submodule motors. Git registers it in .git/config with URL
>    /user/sub, while it should be /central/sub according to
>    documentation because origin's URL is at /central.

The logic for this is in resolve_relative_url, defined in
git-submodule.sh.  The remote it uses is calculated using
get_default_remote, defined in git-parse-remote.sh:

  get_default_remote () {
    curr_branch=$(git symbolic-ref -q HEAD)
    curr_branch="${curr_branch#refs/heads/}"
    origin=$(git config --get "branch.$curr_branch.remote")
    echo ${origin:-origin}
  }

> 2. For an obscure reason, changing the url in .git/config to
> /central/sub and call git submodule update still make git want to
> clone from /user/sub, and fails. There seems to be no way to tell
> git the right URL for this submodule, while it should be possible
> according to the submodule documentation.

This is very surprising to me.  With Git v1.9.1:

* Clone just the superproject, without it's sibling submodule projects:

  $ git clone git://github.com/wking/pygrader.git pg-1

* Clone the isolated superproject, so we'll have broken relative URLs:

  $ git clone pg-1 pg-2

* Initialize a submodule:

  $ git submodule init dep/src/pyassuan

* Fix the broken, expanded-from-relative URL to point back to the
  original:

  $ git config submodule.dep/src/pyassuan.url git://github.com/wking/pyassuan.git

* Initial, cloning update:

  $ git submodule update

That all works as expected for me.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2014-06-12 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 10:15 Relative submodule URLs, and forks that haven't forked the submodule Charles Brossollet
2014-06-12 15:25 ` Fredrik Gustafsson
2014-06-12 16:05   ` Charles Brossollet
2014-06-12 18:05     ` W. Trevor King [this message]

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=20140612180543.GA28801@odin.tremily.us \
    --to=wking@tremily.us \
    --cc=chbrosso@lltech.fr \
    --cc=git@vger.kernel.org \
    --cc=iveqy@iveqy.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).