Kyle Meyer <kyle@xxxxxxxxxx> writes: [...] > diff --git a/git-submodule.sh b/git-submodule.sh > index 514ede2596..6c74656027 100755 > --- a/git-submodule.sh > +++ b/git-submodule.sh > @@ -234,10 +234,18 @@ cmd_add() > if test -z "$force" && > ! git add --dry-run --ignore-missing --no-warn-embedded-repo "$sm_path" > /dev/null 2>&1 > then > - eval_gettextln "The following path is ignored by one of your .gitignore files: > + if test -d "$sm_path" && > + test -z $(git -C "$sm_path" rev-parse --show-cdup 2>/dev/null) && > + ! git -C "$sm_path" rev-parse --verify -q HEAD >/dev/null > + then > + die "$(eval_gettext "'\$sm_path' does not have any commits")" > + else > + eval_gettextln "\ > +The following path is ignored by one of your .gitignore files: > \$sm_path > Use -f if you really want to add it." >&2 > - exit 1 > + exit 1 > + fi I didn't think through this check, which would have been obvious had I ran the added test without the rest of the patches in this series. It assumes that the 'git add --dry-run' call fails, but that failure depends on the last patch of this series. So I'd need to move this patch to the end or find a new place for this "no commits" check.