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

Re: [PATCH 2/7] submodule foreach: correct path computation in recursive submodules

From
Stefan Beller <sbeller@google.com>
Date
Mar 29, 2016, 19:21 UTC
Message-ID
<CAGZ79ka5_C0HcWGyYThT7O2ts-B1dTkBWEt1MUsbEN-AciE15g@mail.gmail.com>
In-Reply-To
<xmqqk2klxg6b.fsf@gitster.mtv.corp.google.com>
On Tue, Mar 29, 2016 at 12:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Stefan Beller <sbeller@google.com> writes:
>>
>>> The test which is fixed by this patch would report
>>>     Entering 'nested1/nested2/../nested3'
>>> instead of the expected
>>>     Entering '../nested1/nested2/nested3'
>>>
>>> because the prefix is put unconditionally in front and after that a
>>> computed display path with is affected by `wt_prefix`. This is wrong as
>>> any relative path computation would need to be at the front. By emptying
>>> the `wt_prefix` in recursive submodules and adding the information of any
>>> relative path into the `prefix` this is fixed.
>>>
>>> Signed-off-by: Stefan Beller <sbeller@google.com>
>>> ---
>>
>> Nicely explained and executed.
>
> Interestingly, this breakage, as 1/7 shows, only affects the
> "Entering $there" message--I somehow expected from reading the
> description above that the command given to "foreach" is run
> in a wrong submodule directory, but there is no such bug that
> is fixed by this change, as far as "foreach" is concerned.
foreach is a special beast as it is the only submodule command that
ignores the current directory, i.e.
    cd repo/plugins && git submodule foreach ...
also affects submodules in repo/other-submodules.

So yeah this is only about the displaypath being relative to the users cwd, internally we operate from the toplevel directory. :/

Show 6 quoted lines
>
> Which might be an indication that it wasn't so "Nicely explained"
> after all X-<.  Are there codepaths that use the same incorrect
> information (which was fixed by this patch) for things other than
> the message and chdir to an incorrect place?  Then this change is
> fixing more than "just a bug in foreach message".

Each submodule command does its own chdir and computation of the prefix and displaypath. The common thing is the name and the meaning of the variables. Currently I am redoing the other patches to follow this patch. Apparently I still need to hone the commit message to actually transport the message that this only affects the display path.

Show 8 quoted lines
>
> The explanation does not make it clear what the extent of the fix
> is, in other words.
>
> Nevertheless, it is a good fix for "foreach message".  Thanks.  It
> just needs to clarify if that is the only change, or if it fixes
> other things.
>

Thanks, Stefan

Previous: Junio C HamanoNext: Stefan Beller
Message 6 of 17 in “Fix path bugs in submodule commands executed from sub dir [WAS: submodule--helper clone: lose the extra prefix option]”
  1. 0/7 Fix path bugs in submodule commands executed from sub dir [WAS: submodule--helper clone: lose the extra prefix option]Stefan Beller, Mar 28, 2016
  2. 1/7 submodule foreach: test path handling in recursive submodulesStefan Beller, Mar 28, 2016
  3. 2/7 submodule foreach: correct path computation in recursive submodulesStefan Beller, Mar 28, 2016
  4. Junio C HamanoMar 29, 2016
  5. Junio C HamanoMar 29, 2016
  6. Stefan BellerMar 29, 2016
  7. Stefan BellerMar 29, 2016
  8. 3/7 submodule update --init: test path handling in recursive submodulesStefan Beller, Mar 28, 2016
  9. Junio C HamanoMar 29, 2016
  10. 4/7 submodule update --init: correct path handling in recursive submodulesStefan Beller, Mar 28, 2016
  11. Junio C HamanoMar 29, 2016
  12. Junio C HamanoMar 29, 2016
  13. Stefan BellerMar 29, 2016
  14. 5/7 t7407: make expectation as clear as possibleStefan Beller, Mar 28, 2016
  15. Junio C HamanoMar 29, 2016
  16. 6/7 submodule status: test path handling in recursive submodulesStefan Beller, Mar 28, 2016
  17. 7/7 submodule status: fix path handling in recursive submodulesStefan Beller, Mar 28, 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.