git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] submodule tests: replace cloning from . by "$(pwd)"

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 22, 2016, 07:33 UTC
Message-ID
<xmqqh984aldl.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<c6c5ce05-3511-a992-e079-316f0ce90ecd@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 19 quoted lines
>> The logic to construct the relative urls is not smart enough to
>> detect that the ending /. is referring to the directory itself
>> but rather treats it like any other relative path, i.e.
>>
>>     path/to/dir/. + ../relative/path/to/submodule
>>
>> would result in
>>
>>     path/to/dir/relative/path/to/submodule
>>
>> and not omit the "dir" as you may expect.
>>
>> As in a later patch we'll normalize the remote url before the
>> computation of relative urls takes place, we need to first get our
>> test suite in a shape with normalized urls only, which is why we should
>> refrain from cloning from '.'
>
> But you are removing a valid use case from the tests. Aren't you
> sweeping something under the rug with this patch?
I share the same reaction.

If the primary problem being solved is that the combination of a relative URL ../sub and the base URL for the superproject which is set to /path/to/dir/. (due to "clone .") were incorrectly resolved as /path/to/dir/sub (because the buggy relative path logic did not know that removing "/." at the end does not take you to one level up), and a topic that fixes the bug would make that relative URL ../sub to be resolved as /path/to/sub, of course. Otherwise, the topic did not fix the bug.

Now if a test that wanted to have a clone of the superproject by "clone .", which results in the base URL of /path/to/dir/., actually wants to refer in its .gitmodules to /path/to/dir/sub (which after all was where the submodule the test created with or without the bugfix), I would think the right adjustment for the test that used to rely on the buggy behaviour would be to stop using ../sub and instead use ./sub as the relative URL, no? After all, the bug forced the original test writer to write ../sub but the submodule in this case actually is at ./sub relative to its superproject, and that is what the original test writer would have written if the bug weren't there in the first place, no?

Another thing I do not quite understand is why this step comes before the fix. If the "clone ." is adjusted to avoid triggering the buggy behaviour, i.e. making the base URL to /path/to/dir (instead of /path/to/dir/.), wouldn't the relative URL ../sub that was written to work around the bug that hasn't been fixed yet in this step need to be adjusted anyway? It would end up referring to /path/to/sub and not /path/to/dir/sub until the fix is put in place.

Is the removal of remote.origin.url a wrong workaround for that breakage, I wonder... I do not understand that change at all, and I do not think it was explained in the log message.

If we really wanted to update the test before fixing the bug, I would understand if this step changed ../sub (or whatever relative URL that has extra ../ only because the base URL has extra /. at the end to compensate for the buggy resolution) to ./sub in the tests and marked them to expect failure, and then a later step that fixes the bug turns them to expect success without make any other change.

Previous: Johannes SixtNext: Stefan Beller
Message 6 of 11 in “Fix submodule url issues”
  1. 0/3 Fix submodule url issuesStefan Beller, Oct 21, 2016
  2. 1/3 t7506: fix diff order arguments in test_cmpStefan Beller, Oct 21, 2016
  3. 3/3 submodule--helper: normalize funny urlsStefan Beller, Oct 21, 2016
  4. 2/3 submodule tests: replace cloning from . by "$(pwd)"Stefan Beller, Oct 21, 2016
  5. Johannes SixtOct 22, 2016
  6. Junio C HamanoOct 22, 2016
  7. Stefan BellerOct 22, 2016
  8. Johannes SixtOct 23, 2016
  9. Junio C HamanoOct 24, 2016
  10. Stefan BellerOct 24, 2016
  11. Johannes SixtOct 24, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.