range-diff: suppress line count in outer diff
[gitweb.git] / git-submodule.sh
index e3c054bde5f1d6fb858071ba7bf2939253811e1f..c7f58c5756f7b6f78689d574c5a2177d1bd409b5 100755 (executable)
@@ -232,6 +232,13 @@ cmd_add()
                die "$(eval_gettext "'\$sm_path' already exists in the index and is not a submodule")"
        fi
 
+       if test -d "$sm_path" &&
+               test -z $(git -C "$sm_path" rev-parse --show-cdup 2>/dev/null)
+       then
+           git -C "$sm_path" rev-parse --verify -q HEAD >/dev/null ||
+           die "$(eval_gettext "'\$sm_path' does not have a commit checked out")"
+       fi
+
        if test -z "$force" &&
                ! git add --dry-run --ignore-missing --no-warn-embedded-repo "$sm_path" > /dev/null 2>&1
        then