]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-submodule.sh
Merge branch 'jk/escaped-wildcard-dwim'
[thirdparty/git.git] / git-submodule.sh
index aaa1809d243c6671a9c6fc959d96bd366a65efec..afcb4c09481c936b21e55b2ebb3802343a9a7c9e 100755 (executable)
@@ -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"