# git submodule: git sync does the wrong thing if the origin URL is relative

1 messages from 2012-05-18 to 2012-05-18. Participants: Jon Seymour.
Thread: https://gitlist.dev/t/30552

## Jon Seymour, 2012-05-18 08:44

Subject: git submodule: git sync does the wrong thing if the origin URL is relative
Message-ID: <CAH3Anrr6mLVedBPcgfVwy=5KRjUgdp5W8P0DQ3qaX_UjH-npDw@mail.gmail.com>
URL: https://gitlist.dev/e/CAH3Anrr6mLVedBPcgfVwy%3D5KRjUgdp5W8P0DQ3qaX_UjH-npDw%40mail.gmail.com

```
The following is a test case that demonstrates a problem with the
heuristic that git sync uses to update the origin URL of submodules in
the case that the origin URL of the super module itself is a relative
URL

I think what it should be doing is prefixing the relative path between
the submodule and the supermodule to the supermodules origin URL as
well as doing what it currently does with the suffix.

Does anyone disagree?

jon.

--

#!/bin/sh
mkdir work &&
cd work &&
rm -rf public &&
rm -rf checkout &&
rm -rf private &&
mkdir public &&
mkdir checkout &&
mkdir -p private/progenitor &&
cd private/progenitor &&
git init &&
mkdir child &&
pushd child &&
git init &&
:> .gitignore &&
git add .gitignore &&
git commit -m "initial child" &&
popd &&
git submodule add ../progenitor/child ./child &&
git commit -m "initial progenitor" &&
git clone --bare . ../../public/progenitor.git &&
git clone --bare child ../../public/progenitor/child.git &&
cd ../../checkout &&
git clone ../public/progenitor.git progenitor &&
cd progenitor &&
git submodule init &&
git submodule update --rebase &&
git fetch origin &&
git submodule foreach git fetch origin &&
git remote set-url origin ../../public/progenitor.git &&
git submodule sync &&
git submodule update --rebase &&
git fetch origin &&
git submodule foreach git fetch origin

```
