On Tue, Oct 18, 2016 at 2:19 PM, Junio C Hamano <gits...@pobox.com> wrote:
> Junio C Hamano <gits...@pobox.com> writes:
>> Stefan Beller <sbel...@google.com> writes:
>>> The remote URL for the submodule can be specified relative
>>> ...
>>> v3:
>>>  * fixed the coding style.
>> Ah, thanks.  I had a squash queued on top but will replace with this
>> one.
> Heh, I guess I shouldn't have responded before seeing what this
> breaks.  Applied on top of sb/submodule-ignore-trailing-slash, these
> seem to break.

Ugh. (I should have tested more than just t0060).

The underlying issue is two fold:

* in t3600 we'd need
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index d046d98..545d32f 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -616,7 +616,7 @@ test_expect_success 'setup subsubmodule' '
        git submodule update &&
        (cd submod &&
                git update-index --add --cacheinfo 160000 $(git
rev-parse HEAD) subsubmod &&
-               git config -f .gitmodules submodule.sub.url ../. &&
+               git config -f .gitmodules submodule.sub.url ./. &&
                git config -f .gitmodules submodule.sub.path subsubmod &&
                git submodule init &&
                git add .gitmodules &&

because the sub-submodule URL is actually the same as the submodule
(because we'd test lazily)

This looks ok from a bug fixers perspective.

However in t7403, we have a construct like:

    git clone . super

which then results in

    git -C super remote -v
...../git/t/trash directory.t7403-submodule-sync/. (fetch)

And the commit message of this patch claimed we'd never use
the /. syntax ourselves. (We could argue the stupid users in the test
suite are doing it wrong, because in practice nobody would use clone
to create a nested repository? Not sure I agree.)

However instead of fixing the levels of nesting, the fix is as easy as:
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 0726799..525d32b 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -15,7 +15,9 @@ test_expect_success setup '
        git add file &&
        test_tick &&
        git commit -m upstream &&
-       git clone . super &&
+       # avoid cloning a repository with a url ending in /.
+       git clone . root &&
+       git clone root super &&
        git clone super submodule &&
                cd submodule &&

Same goes for t740{6,7} as well as t7506.

I think this change to the test suite is not warranted, because
we want to have the current behavior as-is as it seems like a nice

* Maybe we'd want to think about checking for the URL in git clone
  normalize the URL before configuring remote.origin.URL

* an often observed work flow for submodule tests seems:

    mkdir sub1 &&
    git -C sub1 init  &&

    git clone . super &&
    git -C super submodule add ../sub1
    ... # the ../sub1 looks intuitively correct
    # because from the current directory which is
    # super the relative path is ../sub1
    # However in reality this ought to be a relative URL,
    # and as super sits in the same directory as sub1
    # ./sub1 would be "correct" according to the documentation
    # However as the super remote URL ends with /.
    # we had a bug that we needed to add one layer of unnesting
    # and that is how ../sub1 worked.

Not sure about this patch any more.


Reply via email to