You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user clones a repo with --recurse-submodules, clone writes the pathspec . to the config submodule.active.
If this repo at some point in its history had a submodule, but this submodule was then removed, then checking out an older commit where the submodule is still present fails if the checkout uses --recurse-submodules.
Reproducer:
git init checkout-removed-submodule &&
cd checkout-removed-submodule/ &&
echo "Hello, world" >foo &&
git add foo && git commit -m "Initial commit" &&
git init ../submodule &&
cd ../submodule/ &&
echo "Foo bar" >foobar.txt &&
git add foobar.txt && git commit -m "Foo bar baz" &&
cd ../checkout-removed-submodule/ &&
git submodule add ../submodule/ foobar &&
git commit -m "Add foobar submodule" &&
git rm foobar/ &&
git commit -m "Remove foobar submodule" &&
cd ../ &&
git clone --recurse-submodules checkout-removed-submodule cloned-repo &&
cd cloned-repo &&
git co --recurse-submodules HEAD~
fatal: not a git repository: ../.git/modules/foobar
fatal: could not reset submodule index
The text was updated successfully, but these errors were encountered:
phil-blain
changed the title
Improve UX around removed submodules and '--recurse-submodules' for clone and checkout
Improve UX around missing submodules and '--recurse-submodules' for clone and checkoutAug 29, 2022
When a user clones a repo with
--recurse-submodules
,clone
writes the pathspec.
to the configsubmodule.active
.If this repo at some point in its history had a submodule, but this submodule was then removed, then checking out an older commit where the submodule is still present fails if the checkout uses
--recurse-submodules
.Reproducer:
Cf:
https://lore.kernel.org/git/[email protected]/T/#u
https://lore.kernel.org/git/CAE5ih78zCR0ZdHAjoxguUb3Y6KFkZcoxJjhS7rkbtZpr+d1n=g@mail.gmail.com/
A lot of improvements could be made here.
The text was updated successfully, but these errors were encountered: