git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Submodule URL
@ 2011-06-27 22:38 Hilco Wijbenga
       [not found] ` <201106272258.p5RMwOxK028539@no.baka.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Hilco Wijbenga @ 2011-06-27 22:38 UTC (permalink / raw)
  To: Git Users

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Submodule URL
       [not found] ` <201106272258.p5RMwOxK028539@no.baka.org>
@ 2011-06-28  1:28   ` Hilco Wijbenga
  0 siblings, 0 replies; 2+ messages in thread
From: Hilco Wijbenga @ 2011-06-28  1:28 UTC (permalink / raw)
  To: Seth Robertson; +Cc: Git Users

On 27 June 2011 15:58, Seth Robertson <in-gitvger@baka.org> wrote:
> In message <BANLkTikyZxiW_t27Y4bXCPBjbJd_DYbOyw@mail.gmail.com>, Hilco Wijbenga writes:
>
>    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.
>
> Perhaps you should consider gitslave as an alternative to
> git-submodule, depending on your development workflow it may be better
> (or worse).

FYI, yes, somebody read the entire tutorial and learnt something. ;-)

> gitslave (http://gitslave.sf.net) is useful when you control and
> develop on the subprojects at more of less the same time as the
> superproject, and furthermore when you typically want to tag, branch,
> push, pull, etc all repositories at the same time.

:-) Perfect! That's seems to be *exactly* what I need.

How hard is it to turn an umbrella project with content and quite a
few submodules (only 1 level deep) into a gitslave repo?

> git-submodule is better when you do not control the subprojects or
> more specifically wish to fix the subproject at a specific revision
> even as the subproject changes
>
> However, more directly to your question, we see that using absolute
> pathnames (not file: URLs) works.  See
> https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
>
> If this works for you and file:// does not, I'd say it was a bug in
> git.

Well, it seems like a bug to me then. Still, maybe I made a mistake in
my script. I hope somebody else can chime in too.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-28  1:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27 22:38 Submodule URL Hilco Wijbenga
     [not found] ` <201106272258.p5RMwOxK028539@no.baka.org>
2011-06-28  1:28   ` Hilco Wijbenga

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).