Re: [PATCH 2/2] submodule: fix handling of supermodules with relative origin URLs

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


On Sun, May 20, 2012 at 9:10 AM, Jon Seymour <jon.seymour@xxxxxxxxx> wrote:
> On Sun, May 20, 2012 at 8:51 AM, Jon Seymour <jon.seymour@xxxxxxxxx> wrote:
>> On Sun, May 20, 2012 at 4:56 AM, Jens Lehmann <Jens.Lehmann@xxxxxx> wrote:
>>> Am 19.05.2012 06:40, schrieb Jon Seymour:
>> I noticed one relative case that is not handled properly yet, but
>> there is a workaround. If the superproject's origin URL is of the
>> form: foo/bar (a case I actually have myself for reasons I can explain
>> if you want me to), then the correct rule doesn't get matched by
>> .*/*). The workaround is for the user to change foo/bar style origin
>> URLs to ./foo/bar.
>>
>> Let me know if I should fix this case now too.
>
> I think this expression:
>
>    remoteurl=$(echo "remoteurl" | sed "s|^[^/][^:]*\$|./&|" )
>    remoteurl=${remoteurl%/}
>
> would normalize remoteurl correctly for the foo/bar case and not any other.
>
> I'd also need to add at least one new test (or do I actually need 3?),
> of course.

Ok. I have a version that implements this fix:

        url="$1"
+       remoteurl=$(echo "$remoteurl" | sed "s|^[^/][^:]*\$|./&|")
        remoteurl=${remoteurl%/}

and...

+                       .*/*)
+                               up_path="$(echo "$2" | sed "s/[^/]*/../g")"
+                               remoteurl=${remoteurl#./}
+                               remoteurl="${up_path%/}/${remoteurl%/*}"
+                               ;;

with a single test that demonstrates that it works. The additional #./
tweak is so that submodule URLs end up like:

   ../foo/sub

instead of:

   ../foo/./sub

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


[Newbies FAQ]     [Linux Kernel Development]     [Free Online Dating]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Free Online Dating]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]     [Linux Resources]

Add to Google