Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2022-08-19 19:04:10 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-19 21:13:16 +0300
commit2b057d97d796d9192ec899a2109924cabba23ba6 (patch)
treed4abec5133268f45dbea0fda652df9da32067dcd /t/t3903-stash.sh
parent1c3502b198a211031619ce22870490b1498c15dd (diff)
builtin/stash.c: let parse-options parse subcommands
'git stash' parses its subcommands with a long list of if-else if statements. parse-options has just learned to parse subcommands, so let's use that facility instead, with the benefits of shorter code, and listing subcommands for Bash completion. Note that the push_stash() function implementing the 'push' subcommand accepts an extra flag parameter to indicate whether push was assumed, so add a wrapper function with the standard subcommand function signature. Note also that this change "hides" the '-h' option in 'git stash push -h' from the parse_option() call in cmd_stash(), as it comes after the subcommand. Consequently, from now on it will emit the usage of the 'push' subcommand instead of the usage of 'git stash'. We had a failing test for this case, which can now be flipped to expect success. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-xt/t3903-stash.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 2a4c3fd61c..376cc8f4ab 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -25,7 +25,7 @@ test_expect_success 'usage on main command -h emits a summary of subcommands' '
grep -F "or: git stash show" usage
'
-test_expect_failure 'usage for subcommands should emit subcommand usage' '
+test_expect_success 'usage for subcommands should emit subcommand usage' '
test_expect_code 129 git stash push -h >usage &&
grep -F "usage: git stash [push" usage
'