aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-02-14 14:15:50 -0800
committerJunio C Hamano <gitster@pobox.com>2023-02-14 14:15:50 -0800
commit7cbfd0e572560040df3381efb91e3b52b524e128 (patch)
tree07de4477baafc17bb06513d85a4bab78f38336f3
parent259988af42caa4e17d410790d75dd939144bad24 (diff)
parent6d5e9e53aa46b97227a25c85400fd00b8237411a (diff)
downloadgit-7cbfd0e572560040df3381efb91e3b52b524e128.tar.gz
Merge branch 'ab/bundle-wo-args' into maint-2.39
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>"
-rw-r--r--builtin/bundle.c9
-rwxr-xr-xt/t6020-bundle-misc.sh7
2 files changed, 11 insertions, 5 deletions
diff --git a/builtin/bundle.c b/builtin/bundle.c
index c12c09f854..acceef6200 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -55,13 +55,12 @@ static int parse_options_cmd_bundle(int argc,
const char * const usagestr[],
const struct option options[],
char **bundle_file) {
- int newargc;
- newargc = parse_options(argc, argv, NULL, options, usagestr,
+ argc = parse_options(argc, argv, NULL, options, usagestr,
PARSE_OPT_STOP_AT_NON_OPTION);
- if (argc < 1)
- usage_with_options(usagestr, options);
+ if (!argc)
+ usage_msg_opt(_("need a <file> argument"), usagestr, options);
*bundle_file = prefix_filename(prefix, argv[0]);
- return newargc;
+ return argc;
}
static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index 833205125a..3a1cf30b1d 100755
--- a/t/t6020-bundle-misc.sh
+++ b/t/t6020-bundle-misc.sh
@@ -11,6 +11,13 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bundle.sh
+for cmd in create verify list-heads unbundle
+do
+ test_expect_success "usage: git bundle $cmd needs an argument" '
+ test_expect_code 129 git bundle $cmd
+ '
+done
+
# Create a commit or tag and set the variable with the object ID.
test_commit_setvar () {
notick=