parse-options: exit 0 on -h

The standard philosophy for Unix software when a help option (such as --help) is specified is that the software should exit 0, printing the help output to standard output, since the standard output is for user-requested output and the program performed the requested task successfully. If the user specifies an incorrect option, then the help output should be printed to standard error (since the user has made a mistake) and it should exit unsuccessfully. Most of our commands currently exit 129 on receiving the -h option to print the short help, which does not line up with the standard philosophy above. Let's change that to exit 0 instead. This requires changes to a variety of tests which previously wanted the 129 exit code, so update them. Note that because git diff does its own option parsing, it still exits with 129, so update some of the tests to expect either exit status. Some commands also now pass with -h but not --help-all, so handle those cases differently for those commands. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jul 8, 2026 at 00:15 UTC cdaf12f762855b293829ccf540698f86ccb9655e
37 files changed +85 -71
builtin/blame.c
+1
@@ -1013,6 +1013,7 @@ int cmd_blame(int argc,
1013 case PARSE_OPT_UNKNOWN:
1014 break;
1015 case PARSE_OPT_HELP:
1016 + exit(0);
1017 case PARSE_OPT_HELP_ERROR:
1018 case PARSE_OPT_ERROR:
1019 case PARSE_OPT_SUBCOMMAND:
builtin/shortlog.c
+1
@@ -433,6 +433,7 @@ int cmd_shortlog(int argc,
433 case PARSE_OPT_UNKNOWN:
434 break;
435 case PARSE_OPT_HELP:
436 + exit(0);
437 case PARSE_OPT_HELP_ERROR:
438 case PARSE_OPT_ERROR:
439 case PARSE_OPT_SUBCOMMAND:
builtin/update-index.c
+1
@@ -1133,6 +1133,7 @@ int cmd_update_index(int argc,
1133 break;
1134 switch (parseopt_state) {
1135 case PARSE_OPT_HELP:
1136 + exit(0);
1137 case PARSE_OPT_HELP_ERROR:
1138 case PARSE_OPT_ERROR:
1139 exit(129);
contrib/subtree/t/t7900-subtree.sh
+1 -1
@@ -99,7 +99,7 @@ test_create_subtree_add () {
99 }
100
101 test_expect_success 'shows short help text for -h' '
102 - test_expect_code 129 git subtree -h >out 2>err &&
102 + git subtree -h >out 2>err &&
103 test_must_be_empty err &&
104 grep -e "^ *or: git subtree pull" out &&
105 grep -F -e "--[no-]annotate" out
parse-options.c
+8 -3
@@ -1135,8 +1135,9 @@ enum parse_opt_result parse_options_step(struct parse_opt_ctx_t *ctx,
1135 case PARSE_OPT_UNKNOWN:
1136 goto unknown;
1137 case PARSE_OPT_HELP:
1138 - case PARSE_OPT_HELP_ERROR:
1138 goto show_usage;
1139 + case PARSE_OPT_HELP_ERROR:
1140 + goto show_usage_stderr;
1141 case PARSE_OPT_NON_OPTION:
1142 case PARSE_OPT_SUBCOMMAND:
1143 case PARSE_OPT_COMPLETE:
@@ -1170,6 +1171,9 @@ unknown:
1171 show_usage:
1172 return usage_with_options_internal(ctx, usagestr, options,
1173 USAGE_NORMAL, USAGE_TO_STDOUT);
1174 + show_usage_stderr:
1175 + return usage_with_options_internal(ctx, usagestr, options,
1176 + USAGE_NORMAL, USAGE_TO_STDERR);
1177 }
1178
1179 int parse_options_end(struct parse_opt_ctx_t *ctx)
@@ -1201,6 +1205,7 @@ int parse_options(int argc, const char **argv,
1205 parse_options_start_1(&ctx, argc, argv, prefix, options, flags);
1206 switch (parse_options_step(&ctx, options, usagestr)) {
1207 case PARSE_OPT_HELP:
1208 + exit(0);
1209 case PARSE_OPT_HELP_ERROR:
1210 case PARSE_OPT_ERROR:
1211 exit(129);
@@ -1500,11 +1505,11 @@ void show_usage_with_options_if_asked(int ac, const char **av,
1505 if (!strcmp(av[1], "-h")) {
1506 usage_with_options_internal(NULL, usagestr, opts,
1507 USAGE_NORMAL, USAGE_TO_STDOUT);
1503 - exit(129);
1508 + exit(0);
1509 } else if (!strcmp(av[1], "--help-all")) {
1510 usage_with_options_internal(NULL, usagestr, opts,
1511 USAGE_FULL, USAGE_TO_STDOUT);
1507 - exit(129);
1512 + exit(0);
1513 }
1514 }
1515 }
t/for-each-ref-tests.sh
+1 -1
@@ -522,7 +522,7 @@ test_expect_success 'Verify descending sort' '
522 '
523
524 test_expect_success 'Give help even with invalid sort atoms' '
525 - test_expect_code 129 ${git_for_each_ref} --sort=bogus -h >actual 2>&1 &&
525 + ${git_for_each_ref} --sort=bogus -h >actual 2>&1 &&
526 grep "^usage: ${git_for_each_ref}" actual
527 '
528
t/t0012-help.sh
+1 -1
@@ -260,7 +260,7 @@ do
260 (
261 GIT_CEILING_DIRECTORIES=$(pwd) &&
262 export GIT_CEILING_DIRECTORIES &&
263 - test_expect_code 129 git -C sub $builtin -h >output 2>err
263 + git -C sub $builtin -h >output 2>err
264 ) &&
265 test_must_be_empty err &&
266 test_grep usage output
t/t0040-parse-options.sh
+1 -1
@@ -68,7 +68,7 @@ Alias
68 EOF
69
70 test_expect_success 'test help' '
71 - test_must_fail test-tool parse-options -h >output 2>output.err &&
71 + test-tool parse-options -h >output 2>output.err &&
72 test_must_be_empty output.err &&
73 test_cmp expect output
74 '
t/t0450-txt-doc-vs-help.sh
+1 -1
@@ -29,7 +29,7 @@ help_to_synopsis () {
29 return 0
30 fi &&
31 mkdir -p "$out_dir" &&
32 - test_expect_code 129 git $builtin -h >"$out.raw" 2>&1 &&
32 + test_might_fail git $builtin -h >"$out.raw" 2>&1 &&
33 sed -n \
34 -e '1,/^$/ {
35 /^$/d;
t/t0610-reftable-basics.sh
+2 -2
@@ -15,9 +15,9 @@ export GIT_TEST_DEFAULT_REF_FORMAT
15 INVALID_OID=$(test_oid 001)
16
17 test_expect_success 'pack-refs does not crash with -h' '
18 - test_expect_code 129 git pack-refs -h >usage &&
18 + git pack-refs -h >usage &&
19 test_grep "[Uu]sage: git pack-refs " usage &&
20 - test_expect_code 129 nongit git pack-refs -h >usage &&
20 + nongit git pack-refs -h >usage &&
21 test_grep "[Uu]sage: git pack-refs " usage
22 '
23
t/t1403-show-ref.sh
+1 -1
@@ -165,7 +165,7 @@ test_expect_success 'show-ref --branches, --tags, --head, pattern' '
165 '
166
167 test_expect_success 'show-ref --heads is deprecated and hidden' '
168 - test_expect_code 129 git show-ref -h >short-help &&
168 + git show-ref -h >short-help &&
169 test_grep ! -e --heads short-help &&
170 git show-ref --heads >actual 2>warning &&
171 test_grep ! deprecated warning &&
t/t1410-reflog.sh
+2 -2
@@ -107,12 +107,12 @@ test_expect_success setup '
107 '
108
109 test_expect_success 'correct usage on sub-command -h' '
110 - test_expect_code 129 git reflog expire -h >err &&
110 + git reflog expire -h >err &&
111 grep "git reflog expire" err
112 '
113
114 test_expect_success 'correct usage on "git reflog show -h"' '
115 - test_expect_code 129 git reflog show -h >err &&
115 + git reflog show -h >err &&
116 grep -F "git reflog [show]" err
117 '
118
t/t1418-reflog-exists.sh
+1 -1
@@ -12,7 +12,7 @@ test_expect_success 'setup' '
12
13 test_expect_success 'usage' '
14 test_expect_code 129 git reflog exists &&
15 - test_expect_code 129 git reflog exists -h
15 + git reflog exists -h
16 '
17
18 test_expect_success 'usage: unknown option' '
t/t1502-rev-parse-parseopt.sh
+7 -7
@@ -75,7 +75,7 @@ EOF
75 '
76
77 test_expect_success 'test --parseopt help output' '
78 - test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
78 + git rev-parse --parseopt -- -h > output < optionspec &&
79 test_cmp "$TEST_DIRECTORY/t1502/optionspec.help" output
80 '
81
@@ -89,7 +89,7 @@ test_expect_success 'test --parseopt help output no switches' '
89 |EOF
90 |exit 0
91 END_EXPECT
92 - test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec_no_switches &&
92 + git rev-parse --parseopt -- -h > output < optionspec_no_switches &&
93 test_cmp expect output
94 '
95
@@ -103,7 +103,7 @@ test_expect_success 'test --parseopt help output hidden switches' '
103 |EOF
104 |exit 0
105 END_EXPECT
106 - test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec_only_hidden_switches &&
106 + git rev-parse --parseopt -- -h > output < optionspec_only_hidden_switches &&
107 test_cmp expect output
108 '
109
@@ -119,7 +119,7 @@ test_expect_success 'test --parseopt help-all output hidden switches' '
119 |EOF
120 |exit 0
121 END_EXPECT
122 - test_expect_code 129 git rev-parse --parseopt -- --help-all > output < optionspec_only_hidden_switches &&
122 + git rev-parse --parseopt -- --help-all > output < optionspec_only_hidden_switches &&
123 test_cmp expect output
124 '
125
@@ -258,7 +258,7 @@ test_expect_success 'test --parseopt help output: "wrapped" options normal "or:"
258 |exit 0
259 END_EXPECT
260
261 - test_must_fail git rev-parse --parseopt -- -h <spec >actual &&
261 + git rev-parse --parseopt -- -h <spec >actual &&
262 test_cmp expect actual
263 '
264
@@ -296,12 +296,12 @@ test_expect_success 'test --parseopt help output: multi-line blurb after empty l
296 |exit 0
297 END_EXPECT
298
299 - test_must_fail git rev-parse --parseopt -- -h <spec >actual &&
299 + git rev-parse --parseopt -- -h <spec >actual &&
300 test_cmp expect actual
301 '
302
303 test_expect_success 'test --parseopt help output for optionspec-neg' '
304 - test_expect_code 129 git rev-parse --parseopt -- \
304 + git rev-parse --parseopt -- \
305 -h >output <"$TEST_DIRECTORY/t1502/optionspec-neg" &&
306 test_cmp "$TEST_DIRECTORY/t1502/optionspec-neg.help" output
307 '
t/t1517-outside-repo.sh
+23 -16
@@ -129,18 +129,25 @@ do
129 archimport | citool | credential-netrc | credential-libsecret | \
130 credential-osxkeychain | cvsexportcommit | cvsimport | cvsserver | \
131 daemon | \
132 - difftool--helper | filter-branch | format-rev | fsck-objects | \
133 - get-tar-commit-id | \
132 + difftool--helper | format-rev | fsck-objects | get-tar-commit-id | \
133 gui | gui--askpass | \
135 - http-backend | http-fetch | http-push | init-db | instaweb | \
136 - merge-octopus | merge-one-file | merge-resolve | mergetool | \
137 - mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
138 - remote-http | remote-https | replay | request-pull | send-email | \
139 - sh-i18n--envsubst | shell | show | stage | submodule | svn | \
140 - upload-archive--writer | upload-pack | web--browse | whatchanged)
141 - expect_outcome=expect_failure ;;
134 + http-backend | http-fetch | http-push | init-db | \
135 + mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \
136 + remote-http | remote-https | replay | send-email | \
137 + sh-i18n--envsubst | shell | show | stage | \
138 + upload-archive--writer | upload-pack | whatchanged)
139 + h_expect_outcome=expect_failure
140 + all_expect_outcome=expect_failure
141 + ;;
142 + filter-branch | merge-octopus | merge-one-file | merge-resolve | \
143 + mergetool | submodule | svn | web--browse)
144 + h_expect_outcome=expect_success
145 + all_expect_outcome=expect_failure
146 + ;;
147 *)
143 - expect_outcome=expect_success ;;
148 + h_expect_outcome=expect_success
149 + all_expect_outcome=expect_success
150 + ;;
151 esac
152 case "$cmd" in
153 instaweb)
@@ -150,20 +157,20 @@ do
157 *)
158 prereq= ;;
159 esac
153 - test_$expect_outcome $prereq "'git $cmd -h' outside a repository" '
154 - test_expect_code 129 nongit git $cmd -h >usage &&
160 + test_$h_expect_outcome $prereq "'git $cmd -h' outside a repository" '
161 + nongit git $cmd -h >usage &&
162 test_grep "[Uu]sage: git $cmd " usage
163 '
157 - test_$expect_outcome $prereq "'git $cmd --help-all' outside a repository" '
158 - test_expect_code 129 nongit git $cmd --help-all >usage &&
164 + test_$all_expect_outcome $prereq "'git $cmd --help-all' outside a repository" '
165 + nongit git $cmd --help-all >usage &&
166 test_grep "[Uu]sage: git $cmd " usage
167 '
168 done
169
170 test_expect_success 'fmt-merge-msg does not crash with -h' '
164 - test_expect_code 129 git fmt-merge-msg -h >usage &&
171 + git fmt-merge-msg -h >usage &&
172 test_grep "[Uu]sage: git fmt-merge-msg " usage &&
166 - test_expect_code 129 nongit git fmt-merge-msg -h >usage &&
173 + nongit git fmt-merge-msg -h >usage &&
174 test_grep "[Uu]sage: git fmt-merge-msg " usage
175 '
176
t/t1800-hook.sh
+2 -2
@@ -75,10 +75,10 @@ sentinel_detector () {
75 test_expect_success 'git hook usage' '
76 test_expect_code 129 git hook &&
77 test_expect_code 129 git hook run &&
78 - test_expect_code 129 git hook run -h &&
78 + git hook run -h &&
79 test_expect_code 129 git hook run --unknown 2>err &&
80 test_expect_code 129 git hook list &&
81 - test_expect_code 129 git hook list -h &&
81 + git hook list -h &&
82 grep "unknown option" err
83 '
84
t/t1900-repo-info.sh
+1 -1
@@ -150,7 +150,7 @@ test_expect_success 'git repo info --keys uses lines as its default output forma
150 '
151
152 test_expect_success 'git repo info -h shows only repo info usage' '
153 - test_must_fail git repo info -h >actual &&
153 + git repo info -h >actual &&
154 test_grep "git repo info" actual &&
155 test_grep ! "git repo structure" actual
156 '
t/t1901-repo-structure.sh
+1 -1
@@ -225,7 +225,7 @@ test_expect_success 'progress meter option' '
225 '
226
227 test_expect_success 'git repo structure -h shows only repo structure usage' '
228 - test_must_fail git repo structure -h >actual &&
228 + git repo structure -h >actual &&
229 test_grep "git repo structure" actual &&
230 test_grep ! "git repo info" actual
231 '
t/t2006-checkout-index-basic.sh
+3 -3
@@ -16,15 +16,15 @@ test_expect_success 'checkout-index -h in broken repository' '
16 cd broken &&
17 git init &&
18 >.git/index &&
19 - test_expect_code 129 git checkout-index -h >usage 2>&1
19 + git checkout-index -h >usage 2>&1
20 ) &&
21 test_grep "[Uu]sage" broken/usage
22 '
23
24 test_expect_success 'checkout-index does not crash with -h' '
25 - test_expect_code 129 git checkout-index -h >usage &&
25 + git checkout-index -h >usage &&
26 test_grep "[Uu]sage: git checkout-index " usage &&
27 - test_expect_code 129 nongit git checkout-index -h >usage &&
27 + nongit git checkout-index -h >usage &&
28 test_grep "[Uu]sage: git checkout-index " usage
29 '
30
t/t2107-update-index-basic.sh
+1 -1
@@ -23,7 +23,7 @@ test_expect_success 'update-index -h with corrupt index' '
23 cd broken &&
24 git init &&
25 >.git/index &&
26 - test_expect_code 129 git update-index -h >usage 2>&1
26 + git update-index -h >usage 2>&1
27 ) &&
28 test_grep "[Uu]sage: git update-index" broken/usage
29 '
t/t3004-ls-files-basic.sh
+3 -3
@@ -29,15 +29,15 @@ test_expect_success 'ls-files -h in corrupt repository' '
29 cd broken &&
30 git init &&
31 >.git/index &&
32 - test_expect_code 129 git ls-files -h >usage 2>&1
32 + git ls-files -h >usage 2>&1
33 ) &&
34 test_grep "[Uu]sage: git ls-files " broken/usage
35 '
36
37 test_expect_success 'ls-files does not crash with -h' '
38 - test_expect_code 129 git ls-files -h >usage &&
38 + git ls-files -h >usage &&
39 test_grep "[Uu]sage: git ls-files " usage &&
40 - test_expect_code 129 nongit git ls-files -h >usage &&
40 + nongit git ls-files -h >usage &&
41 test_grep "[Uu]sage: git ls-files " usage
42 '
43
t/t3200-branch.sh
+1 -1
@@ -33,7 +33,7 @@ test_expect_success REFFILES 'branch -h in broken repository' '
33 cd broken &&
34 git init -b main &&
35 >.git/refs/heads/main &&
36 - test_expect_code 129 git branch -h >usage 2>&1
36 + git branch -h >usage 2>&1
37 ) &&
38 test_grep "[Uu]sage" broken/usage
39 '
t/t3903-stash.sh
+2 -2
@@ -27,13 +27,13 @@ test_expect_success 'usage on cmd and subcommand invalid option' '
27 '
28
29 test_expect_success 'usage on main command -h emits a summary of subcommands' '
30 - test_expect_code 129 git stash -h >usage &&
30 + git stash -h >usage &&
31 grep -F "usage: git stash list" usage &&
32 grep -F "or: git stash show" usage
33 '
34
35 test_expect_success 'usage for subcommands should emit subcommand usage' '
36 - test_expect_code 129 git stash push -h >usage &&
36 + git stash push -h >usage &&
37 grep -F "usage: git stash [push" usage
38 '
39
t/t4200-rerere.sh
+1 -1
@@ -438,7 +438,7 @@ test_expect_success 'rerere --no-no-rerere-autoupdate' '
438 '
439
440 test_expect_success 'rerere -h' '
441 - test_must_fail git rerere -h >help &&
441 + git rerere -h >help &&
442 test_grep [Uu]sage help
443 '
444
t/t5200-update-server-info.sh
+1 -1
@@ -47,7 +47,7 @@ test_expect_success 'midx does not create duplicate pack entries' '
47 '
48
49 test_expect_success 'update-server-info does not crash with -h' '
50 - test_expect_code 129 git update-server-info -h >usage &&
50 + git update-server-info -h >usage &&
51 test_grep "[Uu]sage: git update-server-info " usage
52 '
53
t/t5304-prune.sh
+1 -1
@@ -365,7 +365,7 @@ test_expect_success 'gc.recentObjectsHook' '
365 '
366
367 test_expect_success 'prune does not crash with -h' '
368 - test_expect_code 129 git prune -h >usage &&
368 + git prune -h >usage &&
369 test_grep "[Uu]sage: git prune " usage
370 '
371
t/t5400-send-pack.sh
+2 -2
@@ -56,9 +56,9 @@ test_expect_success setup '
56 git log'
57
58 test_expect_success 'send-pack does not crash with -h' '
59 - test_expect_code 129 git send-pack -h >usage &&
59 + git send-pack -h >usage &&
60 test_grep "[Uu]sage: git send-pack " usage &&
61 - test_expect_code 129 nongit git send-pack -h >usage &&
61 + nongit git send-pack -h >usage &&
62 test_grep "[Uu]sage: git send-pack " usage
63 '
64
t/t5512-ls-remote.sh
+1 -1
@@ -86,7 +86,7 @@ test_expect_success 'ls-remote -h is deprecated w/o warning' '
86 '
87
88 test_expect_success 'ls-remote --heads is deprecated and hidden w/o warning' '
89 - test_expect_code 129 git ls-remote -h >short-help &&
89 + git ls-remote -h >short-help &&
90 test_grep ! -e --head short-help &&
91 git ls-remote --heads self >actual 2>warning &&
92 test_cmp expected.branches actual &&
t/t6300-for-each-ref.sh
+2 -2
@@ -8,9 +8,9 @@ test_description='for-each-ref test'
8 . ./test-lib.sh
9
10 test_expect_success "for-each-ref does not crash with -h" '
11 - test_expect_code 129 git for-each-ref -h >usage &&
11 + git for-each-ref -h >usage &&
12 test_grep "[Uu]sage: git for-each-ref " usage &&
13 - test_expect_code 129 nongit git for-each-ref -h >usage &&
13 + nongit git for-each-ref -h >usage &&
14 test_grep "[Uu]sage: git for-each-ref " usage
15 '
16
t/t6500-gc.sh
+1 -1
@@ -35,7 +35,7 @@ test_expect_success 'gc -h with invalid configuration' '
35 cd broken &&
36 git init &&
37 echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
38 - test_expect_code 129 git gc -h >usage 2>&1
38 + git gc -h >usage 2>&1
39 ) &&
40 test_grep "[Uu]sage" broken/usage
41 '
t/t7030-verify-tag.sh
+2 -2
@@ -8,9 +8,9 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 . "$TEST_DIRECTORY/lib-gpg.sh"
9
10 test_expect_success GPG 'verify-tag does not crash with -h' '
11 - test_expect_code 129 git verify-tag -h >usage &&
11 + git verify-tag -h >usage &&
12 test_grep "[Uu]sage: git verify-tag " usage &&
13 - test_expect_code 129 nongit git verify-tag -h >usage &&
13 + nongit git verify-tag -h >usage &&
14 test_grep "[Uu]sage: git verify-tag " usage
15 '
16
t/t7508-status.sh
+2 -2
@@ -16,7 +16,7 @@ test_expect_success 'status -h in broken repository' '
16 cd broken &&
17 git init &&
18 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
19 - test_expect_code 129 git status -h >usage 2>&1
19 + git status -h >usage 2>&1
20 ) &&
21 test_grep "[Uu]sage" broken/usage
22 '
@@ -28,7 +28,7 @@ test_expect_success 'commit -h in broken repository' '
28 cd broken &&
29 git init &&
30 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
31 - test_expect_code 129 git commit -h >usage 2>&1
31 + git commit -h >usage 2>&1
32 ) &&
33 test_grep "[Uu]sage" broken/usage
34 '
t/t7510-signed-commit.sh
+2 -2
@@ -9,9 +9,9 @@ GNUPGHOME_NOT_USED=$GNUPGHOME
9 . "$TEST_DIRECTORY/lib-gpg.sh"
10
11 test_expect_success GPG 'verify-commit does not crash with -h' '
12 - test_expect_code 129 git verify-commit -h >usage &&
12 + git verify-commit -h >usage &&
13 test_grep "[Uu]sage: git verify-commit " usage &&
14 - test_expect_code 129 nongit git verify-commit -h >usage &&
14 + nongit git verify-commit -h >usage &&
15 test_grep "[Uu]sage: git verify-commit " usage
16 '
17
t/t7600-merge.sh
+1 -1
@@ -173,7 +173,7 @@ test_expect_success 'merge -h with invalid index' '
173 cd broken &&
174 git init &&
175 >.git/index &&
176 - test_expect_code 129 git merge -h >usage
176 + git merge -h >usage
177 ) &&
178 test_grep "[Uu]sage: git merge" broken/usage
179 '
t/t7800-difftool.sh
+1 -2
@@ -27,12 +27,11 @@ prompt_given ()
27 }
28
29 test_expect_success 'basic usage requires no repo' '
30 - test_expect_code 129 git difftool -h >output &&
30 + git difftool -h >output &&
31 test_grep ^usage: output &&
32 # create a ceiling directory to prevent Git from finding a repo
33 mkdir -p not/repo &&
34 test_when_finished rm -r not &&
35 - test_expect_code 129 \
35 env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
36 git -C not/repo difftool -h >output &&
37 test_grep ^usage: output
t/t7900-maintenance.sh
+1 -1
@@ -35,7 +35,7 @@ test_systemd_analyze_verify () {
35 }
36
37 test_expect_success 'help text' '
38 - test_expect_code 129 git maintenance -h >actual &&
38 + git maintenance -h >actual &&
39 test_grep "usage: git maintenance <subcommand>" actual &&
40 test_expect_code 129 git maintenance barf 2>err &&
41 test_grep "unknown subcommand: \`barf'\''" err &&
usage.c
+1 -1
@@ -188,7 +188,7 @@ static void show_usage_if_asked_helper(const char *err, ...)
188 va_start(params, err);
189 vfreportf(stdout, _("usage: "), err, params);
190 va_end(params);
191 - exit(129);
191 + exit(0);
192 }
193
194 void show_usage_if_asked(int ac, const char **av, const char *err)