git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hilco Wijbenga <hilco.wijbenga@gmail.com>
To: Git Users <git@vger.kernel.org>
Subject: Submodule URL
Date: Mon, 27 Jun 2011 15:38:01 -0700	[thread overview]
Message-ID: <BANLkTikyZxiW_t27Y4bXCPBjbJd_DYbOyw@mail.gmail.com> (raw)

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

Hi all,

As I was creating a script to support a question about submodules I
ran into something that I don't understand. I've attached a simple
script that fails to execute properly. I don't understand why.

In essence, I'm setting up 2 separate, bare repositories on the local
file system. One is intended to be a submodule, the other the umbrella
project. I then try to clone the umbrella project. Although I use
complete, absolute file:// URLs git submodule update --init fails
because .gitmodules uses a relative URL instead of the absolute URL I
provided initially. (Naturally, a relative URL could work too but it
would have to be a different one.) :-)

Should I use a different syntax? Or are file:// URLs not supported for
submodules? Or am I simply misunderstanding how this is supposed to
work?

Cheers,
Hilco

[-- Attachment #2: submodule-repo --]
[-- Type: application/octet-stream, Size: 785 bytes --]

#!/bin/bash

ROOT=$(pwd)
DIR=$ROOT/$(date +%Y%m%d%H%M%S)

REMOTE=$DIR/remote
LOCAL=$DIR/local

mkdir -p $LOCAL

cd $LOCAL
git init --bare $REMOTE/the-module-repo
git clone file://$REMOTE/the-module-repo the-module
cd the-module
touch the-module-file.txt
git add the-module-file.txt
git commit -m 'Version 1.'
git push origin master
rm -rf $LOCAL/the-module

cd $LOCAL
git init --bare $REMOTE/umbrella-repo
git clone file://$REMOTE/umbrella-repo umbrella
cd umbrella
touch file.txt
git add file.txt
git clone file://$REMOTE/the-module-repo the-module
git submodule add ./the-module
git commit -m 'Version 1.'
git push origin master
rm -rf $LOCAL/umbrella

cd $LOCAL
git clone file://$REMOTE/umbrella-repo umbrella
cd umbrella
git checkout master
git submodule update --init --recursive

             reply	other threads:[~2011-06-27 22:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 22:38 Hilco Wijbenga [this message]
     [not found] ` <201106272258.p5RMwOxK028539@no.baka.org>
2011-06-28  1:28   ` Submodule URL Hilco Wijbenga

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=BANLkTikyZxiW_t27Y4bXCPBjbJd_DYbOyw@mail.gmail.com \
    --to=hilco.wijbenga@gmail.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 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).