Subject: Re: [PATCH 0/3] submodule add: allow relative repository path even when no url is set

From: Phil Hord <[email-masked]>
Date: Wed, 08 Jun 2011 09:16:52 -0400

/(Pardon the duplicate; sending this again from my clean MUA.)
/
Sometime last week, Marc Branchaud wrote:
> I believe your case works smoothly only because in your super-project
> you're careful to make sure you have checked out a branch that
> remotely tracks a something in remotes/public.  If you checked out a
> branch that tracks a different remote you'd get different results.
> This seems fragile to me.

Well, I definitely wasn't careful, but in fact I _was_ on a
remote-tracking branch.  The fact that 'git submodule add' is dependent
on the currently-checked-out branch is a surprise to me.

> When you tried the detached-HEAD scenario, did you get URLs for
> "public:git/sub" or "origin:git/sub"?  Does "origin" just happen to be
> the remote you want to use in any case?

Yes, origin happens to be the remote I want to use.  Actually, any of
the remotes would be fine with me because in this case I want to push to
all of them eventually.  The scenario I was working on was where I am
creating a new repository and new submodules to go in it.  All of my
remotes are clones of my repo collection.

git remote -v
git02    git02:foo/tss.git (fetch)
git02    git02:foo/tss.git (push)
origin    public:bar/tss (fetch)
origin    public:bar/tss (push)

> My fundamental point is that "git submodule add" seems to do confusing
> things with relative paths.  Maybe all that's needed is to clarify the
> documentation.  I'll post a patch.

I definitely agree that 'submodule add' does confusing and unexpected
things.   I only got it to work by carefully contriving the exact steps
required to make it work.  Editing .gitmodules directly would have been
much simpler.

Clarifying the documentation is a good first step. But now that you've
made me look at this more closely, I see there is much more to complain
about and, hopefully, get fixed.

I've run out of time today, though.  I'll follow up with another email
on this thread tomorrow.

Thanks for stirring this pot.

Phil