summaryrefslogtreecommitdiff
path: root/t/t1517-outside-repo.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t1517-outside-repo.sh')
-rwxr-xr-xt/t1517-outside-repo.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index dbd8cd6906..c824c1a25c 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -107,4 +107,46 @@ test_expect_success LIBCURL 'remote-http outside repository' '
test_grep "^error: remote-curl" actual
'
+for cmd in $(git --list-cmds=main)
+do
+ cmd=${cmd%.*} # strip .sh, .perl, etc.
+ case "$cmd" in
+ archimport | citool | credential-netrc | credential-libsecret | \
+ credential-osxkeychain | cvsexportcommit | cvsimport | cvsserver | \
+ daemon | \
+ difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \
+ gui | gui--askpass | \
+ http-backend | http-fetch | http-push | init-db | \
+ merge-octopus | merge-one-file | merge-resolve | mergetool | \
+ mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \
+ remote-http | remote-https | replay | send-email | \
+ sh-i18n--envsubst | shell | show | stage | submodule | svn | \
+ upload-archive--writer | upload-pack | web--browse | whatchanged)
+ expect_outcome=expect_failure ;;
+ *)
+ expect_outcome=expect_success ;;
+ esac
+ case "$cmd" in
+ instaweb)
+ prereq=PERL ;;
+ *)
+ prereq= ;;
+ esac
+ test_$expect_outcome $prereq "'git $cmd -h' outside a repository" '
+ test_expect_code 129 nongit git $cmd -h >usage &&
+ test_grep "[Uu]sage: git $cmd " usage
+ '
+ test_$expect_outcome $prereq "'git $cmd --help-all' outside a repository" '
+ test_expect_code 129 nongit git $cmd --help-all >usage &&
+ test_grep "[Uu]sage: git $cmd " usage
+ '
+done
+
+test_expect_success 'fmt-merge-msg does not crash with -h' '
+ test_expect_code 129 git fmt-merge-msg -h >usage &&
+ test_grep "[Uu]sage: git fmt-merge-msg " usage &&
+ test_expect_code 129 nongit git fmt-merge-msg -h >usage &&
+ test_grep "[Uu]sage: git fmt-merge-msg " usage
+'
+
test_done