diff options
| author | Junio C Hamano <gitster@pobox.com> | 2020-02-05 14:34:58 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-02-05 14:34:59 -0800 |
| commit | 25794d6ce9f34ed5dedc569c5050afdb04518744 (patch) | |
| tree | 4e6ae4f1481255ae051b85489ca39f20b7380dff /git-submodule.sh | |
| parent | d0e70cd32e95df3be2250536f9089c858a298874 (diff) | |
| parent | c81638541cbbf5868e79037ca29b6e37e47461e5 (diff) | |
| download | git-25794d6ce9f34ed5dedc569c5050afdb04518744.tar.gz | |
Merge branch 'km/submodule-add-errmsg'
Improve error message generation for "git submodule add".
* km/submodule-add-errmsg:
submodule add: show 'add --dry-run' stderr when aborting
Diffstat (limited to 'git-submodule.sh')
| -rwxr-xr-x | git-submodule.sh | 14 |
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" |
