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

Re: [PATCH v3] submodules: fix of regression on fetching of non-init subsub-repo

From: Peter Kästle <hidden>
Date: 2020-12-09 10:00:19

Possibly related (same subject, not in this thread)

Hi Philippe,

when sending the patch yesterday, I had the gut feeling to hold it back 
to double check it a day later.  Should have done so, some of your 
findings were really stupid mistakes.


On 09.12.20 00:25, Philippe Blain wrote:
Le mar. 8 déc. 2020, à 10 h 43, Peter Kaestle
[off-list ref] a écrit :
quoted
  -- 8< --

Furthermore a regression test case is added, which tests for recursive
fetches on a superproject with uninitialized sub repositories.  This
issue was leading to an infinite loop when doing a revert of a62387b.
I think this paragraph could be removed as it's saying the same thing as
the one below.
jip.

[...]
quoted
+fetch_with_recusion_abort () {
s/recusion/recursion/
yes.

[...]
quoted
+test_expect_success 'setup recursive fetch with uninit submodule' '
+       # does not depend on any previous test setups
+
+       # setup a remote superproject to make git fetch work with an uninit submodule
+       git init --bare super_bare &&
+       git clone super_bare super &&
+       git init sub &&
+
+       >sub/file &&
+       git -C sub add file &&
+       git -C sub commit -m "add file" &&
+       git -C sub rev-parse HEAD >expect &&
+
+       # adding submodule without cloning
+       echo "[submodule \"sub\"]" >super/.gitmodules &&
+       echo "path = sub" >>super/.gitmodules &&
+       echo "url = ../sub" >>super/.gitmodules &&
+       git -C super update-index --add --cacheinfo 160000 $(cat expect) sub &&
+       mkdir super/sub &&
+
+       git -C super submodule status >out &&
+       sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
+       test_cmp expect actual
+'
I think this is overly complicated, what I was hinting at was adding
the submodule
in the superproject before cloning it, so something along these lines:

test_create_repo super &&
test_commit -C super initial &&
test_create_repo sub &&
test_commit -C sub initial &&
git -C sub rev-parse HEAD >expect &&

git -C super submodule add ../sub &&
git -C super commit -m "add sub" &&

git clone super superclone &&
git -C superclone submodule status >out &&
sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
test_cmp expect actual

And then running the two tests below in "superclone".
Indeed, looks much simpler, I gave it a try run and it resulted in same 
behavior, will double check the logic of it and then send v4.  Thanks a lot.

[...]


-- 
kind regards
--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