Re: [RFC PATCH] Move git-dir for submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/21/2011 05:40 PM, Phil Hord wrote:
> On 07/21/2011 04:28 PM, Junio C Hamano wrote:
>> Fredrik Gustafsson<iveqy@xxxxxxxxx>  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).
>

[ Sending this again to unwrap my table. Sorry for the noise. ]

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.
what it should be called and where it should go:

Commit      .gitmodules
  E           linux.path=linux ; linux.url=/blackfin/uclinux-kernel
  D           linux.path=linux ; linux.url=/github/mirrors/linux-2.6.git
  C           linux.path=linux ; linux.url=/torvalds/linux-2.6.git
  B           linux.path=linus ; linux.url=/torvalds/linux-2.6.git
  A           linus.path=linus ; linus.url=/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 presume to 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.  A realistic practical implementation probably would wind up
more 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

> -- 
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]