summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index aaa1809d24..afcb4c0948 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -241,13 +241,15 @@ cmd_add()
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
+ if test -z "$force"
then
- 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
+ dryerr=$(git add --dry-run --ignore-missing --no-warn-embedded-repo "$sm_path" 2>&1 >/dev/null)
+ res=$?
+ if test $res -ne 0
+ then
+ echo >&2 "$dryerr"
+ exit $res
+ fi
fi
if test -n "$custom_name"