]> git.phdru.name Git - git-scripts.git/blob - submodules/unabsorbgitdirs
76d1c40f2797ef1609c3d566738d1e67b7066a5e
[git-scripts.git] / submodules / unabsorbgitdirs
1 #! /bin/sh
2 set -e
3
4 # To the top-level directory of the current submodule
5 cd "`git rev-parse --show-toplevel`"
6
7 unset GIT_DIR
8
9 # If .git/ subdirectory is already here
10 [ -d .git ] && exit 0
11
12 if ! [ -f .git ]; then
13     echo "Error: Cannot find gitlink, aborting" >&2
14     exit 1
15 fi
16
17 # Fix core.worktree now
18 git config --unset core.worktree
19
20 read _gitdir gitpath < .git
21 if [ "$_gitdir" != gitdir: ]; then
22     echo "Error: Bad gitlink, aborting" >&2
23     exit 1
24 fi
25 unset _gitdir
26 rm .git
27 exec mv "$gitpath" .git