summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index e3c054b..c7f58c5 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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