Re: [git] Re: Relative submodule URLs, and forks that haven't forked the submodule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]