git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Hord <hordp@cisco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Fredrik Gustafsson <iveqy@iveqy.com>,
	git@vger.kernel.org, jens.lehmann@web.de, hvoigt@hvoigt.net
Subject: Re: [RFC PATCH] Move git-dir for submodules
Date: Thu, 21 Jul 2011 17:40:42 -0400	[thread overview]
Message-ID: <4E289CDA.20209@cisco.com> (raw)
In-Reply-To: <7vhb6f1ipp.fsf@alter.siamese.dyndns.org>

On 07/21/2011 04:28 PM, Junio C Hamano wrote:
> Fredrik Gustafsson<iveqy@iveqy.com>  writes:
>
>> diff --git a/git-submodule.sh b/git-submodule.sh
>> index 87c9452..3ad3012 100755
>> --- a/git-submodule.sh
>> +++ b/git-submodule.sh
>> @@ -122,14 +122,56 @@ module_clone()
>>   	path=$1
>>   	url=$2
>>   	reference="$3"
>> +	gitdir=
>> +	gitdir_base=
>> +	base_path=`echo $path | sed -e 's|[^/]*$||'`
> We prefer $() over `` these days, no?  Without dq around $path, you would
> not be able to preserve $IFS inside $PATH. You are stripping a run of non
> slash at the trailing end --- is 'dirname "$path"' insufficient?
>
> I think you are using the path the submodule happens to be at in the
> current checkout to decide where in the .git/modules in the superproject
> to keep the submodule metadata directory. Shouldn't you be using
> module_name to convert the $path to the name of the submodule (this is
> important, as the same submodule that used to be at path P1 can be moved
> to a different path P2 in the history).

Now that you mention it, what happens if the submodule name changes in 
the history?
What happens if the submodule URL (and possibly the entire submodule 
contents) changes in the history?

Is there any unique thing simpler than "<submodule-name>+<url>" that can 
be used to uniquely identify "that" submodule repo?

Say I have linux as a submodule in my project.  But over time (or on 
different branches) I have different ideas about what should go there 
(and where it should go):

Commit      .gitmodules
   E           linux.path=linux ; 
linux.url=git://sources.blackfin.uclinux.org/git/linux-kernel
   D           linux.path=linux ; 
linux.url=https://github.com/mirrors/linux-2.6.git
   C           linux.path=linux ; 
linux.url=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
B           linux.path=linus ; 
linux.url=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
A           linus.path=linus ; 
linus.url=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

How many repos are in .git/modules/?  I can imagine anything from 1-5 in 
the implementation.  Logically there should be only 2, ideally (but not 
practically) named something like this:

   .git/modules/linux@blackfin
   .git/modules/linux@torvalds

and where the last one also includes "github/mirrors" as a remote.

But a more practical implementation would end up with three as it 
wouldn't know it could combine the last two:

   .git/modules/linux@blackfin
   .git/modules/linux@torvalds
   .git/modules/linux@github

But maybe a nearly practical implementation could actually wind up with 
one repo and three remotes:

   .git/modules/linux; remotes=blackfin, torvalds, github

But this is likely to confuse the poor user who did not expect all these 
remotes.  Also, a realistic practical implementation probably would wind 
up like this:

   .git/modules/linux; remotes=blackfin, torvalds, github
   .git/modules/linus; remotes=torvalds

In reality I suppose switching repositories like this is simply not 
supported by the code or the patch.  But it's something to think about 
when choosing a name for the .git/modules path.

Phil

  reply	other threads:[~2011-07-21 21:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 16:52 [RFC PATCH] Move git-dir for submodules Fredrik Gustafsson
2011-07-21 20:28 ` Junio C Hamano
2011-07-21 21:40   ` Phil Hord [this message]
2011-07-21 21:50     ` Phil Hord
2011-07-21 23:37       ` Junio C Hamano
2011-07-21 23:47         ` Junio C Hamano
2011-07-22 19:02   ` Fredrik Gustafsson
2011-07-22 20:30     ` Junio C Hamano

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=4E289CDA.20209@cisco.com \
    --to=hordp@cisco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --cc=iveqy@iveqy.com \
    --cc=jens.lehmann@web.de \
    /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).