From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
"git@vger.kernel.org" <git@vger.kernel.org>,
"Karl A." <venv21@gmail.com>,
Dennis Kaarsemaker <dennis@kaarsemaker.net>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCHv3] submodule--helper: normalize funny urls
Date: Tue, 18 Oct 2016 16:25:08 -0700 [thread overview]
Message-ID: <CAGZ79kZHLVpxbJ_C-dM2LDA64-_TJNyY+52fTWkOvLvvAq2XDg@mail.gmail.com> (raw)
In-Reply-To: <xmqqshrtnynj.fsf@gitster.mtv.corp.google.com>
On Tue, Oct 18, 2016 at 2:19 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Stefan Beller <sbeller@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
hack:
* 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.
Stefan
next prev parent reply other threads:[~2016-10-18 23:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 21:06 [PATCHv3] submodule--helper: normalize funny urls Stefan Beller
2016-10-18 21:12 ` Junio C Hamano
2016-10-18 21:19 ` Junio C Hamano
2016-10-18 23:25 ` Stefan Beller [this message]
2016-10-19 0:56 ` Junio C Hamano
2016-10-19 1:04 ` Stefan Beller
2016-10-19 2:05 ` Junio C Hamano
2016-10-20 19:15 ` Stefan Beller
2016-10-20 19:26 ` Junio C Hamano
2016-10-20 19:34 ` Stefan Beller
2016-10-20 19:53 ` Junio C Hamano
2016-10-21 20:56 ` Stefan Beller
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGZ79kZHLVpxbJ_C-dM2LDA64-_TJNyY+52fTWkOvLvvAq2XDg@mail.gmail.com \
--to=sbeller@google.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=dennis@kaarsemaker.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jrnieder@gmail.com \
--cc=venv21@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).