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

Re: BUG in fetching non-checked out submodule

From
PKPeter Kästle <peter.kaestle@nokia.com>
Date
Dec 3, 2020, 15:10 UTC
Message-ID
<5869c005-468b-8686-3022-3fa18f28f96e@nokia.com>
In-Reply-To
<CAN0XMOLdz3bk+wehy-+0_XGLX6722jb71vvzNPXrryeeFuxd0w@mail.gmail.com>
Hi Ralf,
On 03.12.20 13:30, Ralf Thielow wrote:
Show 15 quoted lines
> It can be reproduced with the following sequence of commands:
> 
> git init sub
> cd sub
> touch file
> git add file
> git commit -m "add file"
> cd ..
> git init main
> cd main
> git submodule add ../sub
> git submodule init
> git submodule update --checkout
> git submodule deinit -f sub/
> git fetch --recurse-submodules

With git from master state the "git fetch --recurse-submodules" results in an infinite recurse call.

I translated your sequence into a bash script, which can then be easily converted into a test case for git. Problematic was the infinite recurse loop of the git fetch command, which I solved by grep'ing for the second recursion output and abort using -m1. Could you please confirm, that you see "passed" for the good git versions and "failed" for the bad ones?

#!/bin/bash
testcase () {
         rm -Rf main sub &&
         git init main &&
         git init sub &&
         touch sub/file &&
         git -C sub add file &&
         git -C sub commit -m "add file" &&
         git -C sub rev-parse HEAD >expect &&
         git -C main submodule add ../sub &&
         git -C main submodule init &&
         git -C main submodule update --checkout &&
         git -C main submodule deinit -f sub &&
         ! git -C main fetch --recurse-submodules |&
                 grep -v -m1 "Fetching submodule sub$" &&
         git -C main submodule status |
                 sed -e "s/^-//" -e "s/ sub$//" >actual &&
         cmp expect actual
}
if testcase
then
         echo "passed"
else
         echo "failed"
fi
-- 
--peter;
Previous: Ralf ThielowNext: Ralf Thielow
Message 35 of 36 in “BUG in fetching non-checked out submodule”
  1. Ralf ThielowDec 2, 2020
  2. Philippe BlainDec 2, 2020
  3. Junio C HamanoDec 2, 2020
  4. Peter KästleDec 3, 2020
  5. Philippe BlainDec 3, 2020
  6. Peter KästleDec 3, 2020
  7. Junio C HamanoDec 3, 2020
  8. submodules: fix of regression on fetching of non-init subsub-repoPeter Kaestle, Dec 4, 2020
  9. Eric SunshineDec 4, 2020
  10. Peter KästleDec 7, 2020
  11. Eric SunshineDec 7, 2020
  12. submodules: fix of regression on fetching of non-init subsub-repoPeter Kaestle, Dec 7, 2020
  13. Philippe BlainDec 7, 2020
  14. Junio C HamanoDec 7, 2020
  15. Peter KästleDec 8, 2020
  16. Junio C HamanoDec 7, 2020
  17. Peter KästleDec 8, 2020
  18. Junio C HamanoDec 7, 2020
  19. Philippe BlainDec 7, 2020
  20. Junio C HamanoDec 7, 2020
  21. Junio C HamanoDec 7, 2020
  22. Peter KästleDec 8, 2020
  23. submodules: fix of regression on fetching of non-init subsub-repoPeter Kaestle, Dec 8, 2020
  24. Peter KästleDec 8, 2020
  25. Junio C HamanoDec 8, 2020
  26. Philippe BlainDec 8, 2020
  27. Peter KästleDec 9, 2020
  28. submodules: fix of regression on fetching of non-init subsub-repoPeter Kaestle, Dec 9, 2020
  29. Philippe BlainDec 9, 2020
  30. Ralf ThielowDec 3, 2020
  31. Peter KästleDec 3, 2020
  32. Ralf ThielowDec 3, 2020
  33. Peter KästleDec 3, 2020
  34. Ralf ThielowDec 3, 2020
  35. Peter KästleDec 3, 2020
  36. Ralf ThielowDec 3, 2020

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.