Skip to content

Commit 6585f54

Browse files
committed
Merge branch 'ua/t1517-short-help-tests' into dk/help-all
* ua/t1517-short-help-tests: t5304: move `prune -h` test from t1517 t5200: move `update-server-info -h` test from t1517 t/t1517: automate `git subcmd -h` tests outside a repository
2 parents 866e6a3 + 6722794 commit 6585f54

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

t/t1517-outside-repo.sh

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,26 @@ test_expect_success LIBCURL 'remote-http outside repository' '
107107
test_grep "^error: remote-curl" actual
108108
'
109109

110-
test_expect_success 'update-server-info does not crash with -h' '
111-
test_expect_code 129 git update-server-info -h >usage &&
112-
test_grep "[Uu]sage: git update-server-info " usage &&
113-
test_expect_code 129 nongit git update-server-info -h >usage &&
114-
test_grep "[Uu]sage: git update-server-info " usage
115-
'
116-
117-
test_expect_success 'prune does not crash with -h' '
118-
test_expect_code 129 git prune -h >usage &&
119-
test_grep "[Uu]sage: git prune " usage &&
120-
test_expect_code 129 nongit git prune -h >usage &&
121-
test_grep "[Uu]sage: git prune " usage
122-
'
110+
for cmd in $(git --list-cmds=main)
111+
do
112+
cmd=${cmd%.*} # strip .sh, .perl, etc.
113+
case "$cmd" in
114+
archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \
115+
difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \
116+
http-backend | http-fetch | http-push | init-db | \
117+
merge-octopus | merge-one-file | merge-resolve | mergetool | \
118+
mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \
119+
remote-http | remote-https | replay | send-email | \
120+
sh-i18n--envsubst | shell | show | stage | submodule | svn | \
121+
upload-archive--writer | upload-pack | web--browse | whatchanged)
122+
expect_outcome=expect_failure ;;
123+
*)
124+
expect_outcome=expect_success ;;
125+
esac
126+
test_$expect_outcome "'git $cmd -h' outside a repository" '
127+
test_expect_code 129 nongit git $cmd -h >usage &&
128+
test_grep "[Uu]sage: git $cmd " usage
129+
'
130+
done
123131

124132
test_done

t/t5200-update-server-info.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' '
4646
test_must_be_empty dups
4747
'
4848

49+
test_expect_success 'update-server-info does not crash with -h' '
50+
test_expect_code 129 git update-server-info -h >usage &&
51+
test_grep "[Uu]sage: git update-server-info " usage
52+
'
53+
4954
test_done

t/t5304-prune.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,4 +364,9 @@ test_expect_success 'gc.recentObjectsHook' '
364364
git cat-file -p $BLOB
365365
'
366366

367+
test_expect_success 'prune does not crash with -h' '
368+
test_expect_code 129 git prune -h >usage &&
369+
test_grep "[Uu]sage: git prune " usage
370+
'
371+
367372
test_done

0 commit comments

Comments
 (0)