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

Re: [PATCH v2] add test for bug in git-mv for recursive submodules

From
Stefan Beller <sbeller@google.com>
Date
Sep 18, 2017, 20:03 UTC
Message-ID
<CAGZ79kaycuiFuB1m0SiyKoZ6UyEBCMiipYXkavN+NNyCZaY1=Q@mail.gmail.com>
In-Reply-To
<xmqqlgleup78.fsf@gitster.mtv.corp.google.com>
>> Took a little while but here is a more clean patch creating individual
>> submodules for the nesting.
>>
>> Cheers Heiko
Thanks for writing this test!
>
> Thanks.  Stefan, does this look good to you now?
Yes, though there are nits below.
> It is not quite clear which step is expected to fail with the
> current code by reading the test or the proposed log message.  Does
> "mv" refuse to work and we do not get to run "status", or does
> "status" report a failure, or do we fail well before that?

git-mv failing seems like a new possibility without incurring another process spawn with the new repository object. (Though then we could also just fix the recursed submodule)

Show 26 quoted lines
> The log message that only says "This does not work when ..." is not
> helpful in figuring it out, either.  Something like "This does not
> work and fails to update the paths for its configurations" or
> whatever that describes "what actually happens" (in contrast to
> "what ought to happen", which you described clearly) should be
> there.
>
> Description on how you happened to have discovered the issue feels a
> lot less relevant compared to that, and it is totally useless if it
> is unclear what the issue is in the first place.
>
>>  t/t7001-mv.sh | 25 +++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
>> index e365d1ff77..cbc5fb37fe 100755
>> --- a/t/t7001-mv.sh
>> +++ b/t/t7001-mv.sh
>> @@ -491,4 +491,29 @@ test_expect_success 'moving a submodule in nested directories' '
>>       test_cmp actual expect
>>  '
>>
>> +test_expect_failure 'moving nested submodules' '
>> +     git commit -am "cleanup commit" &&
>> +     mkdir sub_nested_nested &&
>> +     (cd sub_nested_nested &&
We seem to have different styles for nested shell. I prefer
  outside command &&
  (
      first nested command here &&
      ...

as that aligns indentation to the nesting level. I have seen the style you use a lot in the test suite, and we do not have a guideline in Documentation/CodingGuidelines, so I do not complain too loudly. ;)

Show 17 quoted lines
>> +             touch nested_level2 &&
>> +             git init &&
>> +             git add . &&
>> +             git commit -m "nested level 2"
>> +     ) &&
>> +     mkdir sub_nested &&
>> +     (cd sub_nested &&
>> +             touch nested_level1 &&
>> +             git init &&
>> +             git add . &&
>> +             git commit -m "nested level 1"
>> +             git submodule add ../sub_nested_nested &&
>> +             git commit -m "add nested level 2"
>> +     ) &&
>> +     git submodule add ./sub_nested nested_move &&
>> +     git commit -m "add nested_move" &&
>> +     git submodule update --init --recursive &&
So far a nice setup!
>> +     git mv nested_move sub_nested_moved &&

This is the offending command that produces the bug, as it will break most subsequent commands, such as

>> +     git status

git-status is one of the basic commands. Without status to function, I think it is hard to recover your repo without a lot of in-depth knowledge of Git (submodules).

I wonder if git-status should complain more gracefully and fallback to one of --ignore-submodules={dirty, all}, that actually still works.

Maybe we could introduce a new default mode for this flag, that is "none-except-on-error", though this sounds as if we're fixing symptoms instead of the root cause.

Previous: Junio C HamanoNext: Heiko Voigt
Message 7 of 8 in “add test for bug in git-mv with nested submodules”
  1. add test for bug in git-mv with nested submodulesHeiko Voigt, Aug 17, 2017
  2. Stefan BellerAug 17, 2017
  3. Heiko VoigtAug 18, 2017
  4. Stefan BellerAug 18, 2017
  5. add test for bug in git-mv for recursive submodulesHeiko Voigt, Sep 15, 2017
  6. Junio C HamanoSep 17, 2017
  7. Stefan BellerSep 18, 2017
  8. Heiko VoigtSep 20, 2017

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.