Re: [PATCH 2/7] git-submodule: Extract absolute_url & move absolute url logic to module_clone

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

 



On Tue, Apr 22, 2008 at 2:10 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Ping Yin <pkufranky@xxxxxxxxx> writes:
>  > This behaviour change breaks t7400 which uses relative url './.subrepo'.
>  > However, this test originally doesn't mean to test relative url with './',
>  > so fix the url as '.subrepo'.
>
>  Isn't ".subrepo" a relative URL that says "subdirectory of the current
>  one, whose name is .subrepo", exactly the same way as "./.subrepo" is?
>  Shouldn't they behave the same?
>
>  If the test found they do not behave the same, perhaps the new code is
>  broken in some way and isn't "fixing" the test simply hiding a bug?
>

I just want to unify the behaviour of handling relative url.

'git submodule add'  treats './foo' and 'foo' as different urls. The
1st one is relative to remote.origin.url, while the 2nd one is
relative the current directory. I think this kind of behaviour is
better for submodules, so i unify the handling of relative urls as
this.

With this kind of behaviour, i can set 'submodule.foo.url=./foo' in
.gitmodules or $GIT_DIR/config. And when remote.origin.url changes, i
have not to change submodule.foo.url if the super project and
submodule foo are always located on the same central host.

>
>  > +# Resolve relative url/path to absolute one
>  > +absolute_url () {
>  > +     case "$1" in
>  > +     ./*|../*)
>  > +             # dereference source url relative to parent's url
>  > +             url="$(resolve_relative_url $1)" ;;
>  > +     *)
>  > +             # Turn the source into an absolute path if it is local
>  > +             url=$(get_repo_base "$1") ||
>  > +             url=$1
>  > +             ;;
>  > +     esac
>  > +     echo "$url"
>  > +}
>  > +
>  >  #
>  >  # Map submodule path to submodule name
>  >  #
>  > @@ -112,7 +127,7 @@ module_info() {
>  >  module_clone()
>  >  {
>  >       path=$1
>  > -     url=$2
>  > +     url=$(absolute_url "$2")
>  >
>  >       # If there already is a directory at the submodule path,
>  >       # expect it to be empty (since that is the default checkout
>
>  Why does this call-site matter?  The URL is given to "git-clone" which I
>  think does handle the relative URL just fine???
>

As said above.



-- 
Ping Yin
--
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]

  Powered by Linux