Skip to content

Commit bc58ebf

Browse files
committed
Merge branch 'ab/bundle-wo-args'
Fix to a small regression in 2.38 days. * ab/bundle-wo-args: bundle <cmd>: have usage_msg_opt() note the missing "<file>" builtin/bundle.c: remove superfluous "newargc" variable bundle: don't segfault on "git bundle <subcmd>"
2 parents 6b1e4b1 + 6d5e9e5 commit bc58ebf

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

builtin/bundle.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,12 @@ static int parse_options_cmd_bundle(int argc,
5555
const char * const usagestr[],
5656
const struct option options[],
5757
char **bundle_file) {
58-
int newargc;
59-
newargc = parse_options(argc, argv, NULL, options, usagestr,
58+
argc = parse_options(argc, argv, NULL, options, usagestr,
6059
PARSE_OPT_STOP_AT_NON_OPTION);
61-
if (argc < 1)
62-
usage_with_options(usagestr, options);
60+
if (!argc)
61+
usage_msg_opt(_("need a <file> argument"), usagestr, options);
6362
*bundle_file = prefix_filename(prefix, argv[0]);
64-
return newargc;
63+
return argc;
6564
}
6665

6766
static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {

t/t6020-bundle-misc.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1111
. ./test-lib.sh
1212
. "$TEST_DIRECTORY"/lib-bundle.sh
1313

14+
for cmd in create verify list-heads unbundle
15+
do
16+
test_expect_success "usage: git bundle $cmd needs an argument" '
17+
test_expect_code 129 git bundle $cmd
18+
'
19+
done
20+
1421
# Create a commit or tag and set the variable with the object ID.
1522
test_commit_setvar () {
1623
notick=

0 commit comments

Comments
 (0)