Thread (9 messages) 9 messages, 3 authors, 2020-12-03

Re: BUG in fetching non-checked out submodule

From: Peter Kästle <hidden>
Date: 2020-12-03 15:11:32

Hi Ralf,

On 03.12.20 13:30, Ralf Thielow wrote:
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;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help