diff options
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index b5f2beee60..16b49f1419 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -230,6 +230,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 |