diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-10-26 03:11:39 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-26 03:11:39 +0300 |
commit | 1f49b5171a198abc68ae752de5044602ba0ed702 (patch) | |
tree | 7960a3eb8335e8c6fcb89252858680e28a594d86 /builtin | |
parent | 28f9cd0d5fa0dd448c6424630e243ec4862b9dde (diff) | |
parent | 69c5f17f11a2afe6b56b04f5a4377e4332858cde (diff) |
Merge branch 'jk/cleanup-callback-parameters' into maint-2.38
Code clean-up.
* jk/cleanup-callback-parameters:
attr: drop DEBUG_ATTR code
commit: avoid writing to global in option callback
multi-pack-index: avoid writing to global in option callback
test-submodule: inline resolve_relative_url() function
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/commit.c | 4 | ||||
-rw-r--r-- | builtin/multi-pack-index.c | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index fcf9c85947..d9de4ef008 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -139,7 +139,7 @@ static int opt_pass_trailer(const struct option *opt, const char *arg, int unset { BUG_ON_OPT_NEG(unset); - strvec_pushl(&trailer_args, "--trailer", arg, NULL); + strvec_pushl(opt->value, "--trailer", arg, NULL); return 0; } @@ -1633,7 +1633,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) OPT_STRING(0, "fixup", &fixup_message, N_("[(amend|reword):]commit"), N_("use autosquash formatted message to fixup or amend/reword specified commit")), OPT_STRING(0, "squash", &squash_message, N_("commit"), N_("use autosquash formatted message to squash specified commit")), OPT_BOOL(0, "reset-author", &renew_authorship, N_("the commit is authored by me now (used with -C/-c/--amend)")), - OPT_CALLBACK_F(0, "trailer", NULL, N_("trailer"), N_("add custom trailer(s)"), PARSE_OPT_NONEG, opt_pass_trailer), + OPT_CALLBACK_F(0, "trailer", &trailer_args, N_("trailer"), N_("add custom trailer(s)"), PARSE_OPT_NONEG, opt_pass_trailer), OPT_BOOL('s', "signoff", &signoff, N_("add a Signed-off-by trailer")), OPT_FILENAME('t', "template", &template_file, N_("use specified template file")), OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")), diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c index 9b126d6ce0..9a18a82b05 100644 --- a/builtin/multi-pack-index.c +++ b/builtin/multi-pack-index.c @@ -56,11 +56,12 @@ static struct opts_multi_pack_index { static int parse_object_dir(const struct option *opt, const char *arg, int unset) { - free(opts.object_dir); + char **value = opt->value; + free(*value); if (unset) - opts.object_dir = xstrdup(get_object_directory()); + *value = xstrdup(get_object_directory()); else - opts.object_dir = real_pathdup(arg, 1); + *value = real_pathdup(arg, 1); return 0; } |