2 # See https://stackoverflow.com/a/77950870/7976758
5 # To the top-level directory of the current submodule
6 cd "`git rev-parse --show-toplevel`"
10 # If .git/ subdirectory is already here
13 if ! [ -f .git ]; then
14 echo "Error: Cannot find gitlink, aborting" >&2
18 # Fix core.worktree now
19 git config --unset core.worktree
21 read _gitdir gitpath < .git
22 if [ "$_gitdir" != gitdir: ]; then
23 echo "Error: Bad gitlink, aborting" >&2
28 exec mv "$gitpath" .git