summaryrefslogtreecommitdiff
path: root/t/t3903-stash.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-01-10 19:52:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-01-10 19:52:52 (GMT)
commit8ab404ea0463c99fc85095e0419ed08a1486ae92 (patch)
treea323091a34ddc5c150127d2a8781c51ebdb747e5 /t/t3903-stash.sh
parent077e120a1ef689d1f26b2ce854438e50f1240c9b (diff)
parentca7990cea5a1bae665c07587be00b51fa652a9a9 (diff)
downloadgit-8ab404ea0463c99fc85095e0419ed08a1486ae92.zip
git-8ab404ea0463c99fc85095e0419ed08a1486ae92.tar.gz
git-8ab404ea0463c99fc85095e0419ed08a1486ae92.tar.bz2
Merge branch 'ab/do-not-limit-stash-help-to-push'
"git stash" by default triggers its "push" action, but its implementation also made "git stash -h" to show short help only for "git stash push", which has been corrected. * ab/do-not-limit-stash-help-to-push: stash: don't show "git stash push" usage on bad "git stash" usage
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-xt/t3903-stash.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 2c66cfb..b17c52d 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -10,6 +10,25 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
+test_expect_success 'usage on cmd and subcommand invalid option' '
+ test_expect_code 129 git stash --invalid-option 2>usage &&
+ grep "or: git stash" usage &&
+
+ test_expect_code 129 git stash push --invalid-option 2>usage &&
+ ! grep "or: git stash" usage
+'
+
+test_expect_success 'usage on main command -h emits a summary of subcommands' '
+ test_expect_code 129 git stash -h >usage &&
+ grep -F "usage: git stash list" usage &&
+ grep -F "or: git stash show" usage
+'
+
+test_expect_failure 'usage for subcommands should emit subcommand usage' '
+ test_expect_code 129 git stash push -h >usage &&
+ grep -F "usage: git stash [push" usage
+'
+
diff_cmp () {
for i in "$1" "$2"
do