]> git.phdru.name Git - git-scripts.git/blobdiff - submodules/unabsorbgitdirs-recursive
Feat(unabsorbgitdirs): Add a sentinel
[git-scripts.git] / submodules / unabsorbgitdirs-recursive
index 72b4464a6ceb8ba54acc8eb3d4fd12b462b2fdb8..f7427fc31e191985067804f29043074d3d35d003 100755 (executable)
@@ -18,14 +18,14 @@ cd "`git rev-parse --show-toplevel`"
 unset GIT_DIR
 
 # If .git/ subdirectory is already here
-test -d .git && exit 0
+[ -d .git ] && exit 0
 
-if ! test -f .git; then
+if ! [ -f .git ]; then
     echo "Error: Cannot find gitlink, aborting" >&2
     exit 1
 fi
 
-if test -f .gitmodules; then
+if [ -f .gitmodules ]; then
     git submodule foreach "$PROG_DIR"/"`basename \"$0\"`"
 fi
 
@@ -33,6 +33,10 @@ fi
 git config --unset core.worktree
 
 read _gitdir gitpath < .git
+if [ "$_gitdir" != gitdir: ]; then
+    echo "Error: Bad gitlink, aborting" >&2
+    exit 1
+fi
 unset _gitdir
 rm .git
 exec mv "$gitpath" .git