Merge branch 'jp/tag-trailer'
"git tag" learned the "--trailer" option to futz with the trailers in the same way as "git commit" does. * jp/tag-trailer: builtin/tag: add --trailer option builtin/commit: refactor --trailer logic builtin/commit: use ARGV macro to collect trailers
This commit is contained in:
@ -37,6 +37,7 @@
|
||||
#include "commit-reach.h"
|
||||
#include "commit-graph.h"
|
||||
#include "pretty.h"
|
||||
#include "trailer.h"
|
||||
|
||||
static const char * const builtin_commit_usage[] = {
|
||||
N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
|
||||
@ -141,14 +142,6 @@ static struct strbuf message = STRBUF_INIT;
|
||||
|
||||
static enum wt_status_format status_format = STATUS_FORMAT_UNSPECIFIED;
|
||||
|
||||
static int opt_pass_trailer(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
|
||||
strvec_pushl(opt->value, "--trailer", arg, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_parse_porcelain(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
enum wt_status_format *value = (enum wt_status_format *)opt->value;
|
||||
@ -1037,14 +1030,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
fclose(s->fp);
|
||||
|
||||
if (trailer_args.nr) {
|
||||
struct child_process run_trailer = CHILD_PROCESS_INIT;
|
||||
|
||||
strvec_pushl(&run_trailer.args, "interpret-trailers",
|
||||
"--in-place", "--no-divider",
|
||||
git_path_commit_editmsg(), NULL);
|
||||
strvec_pushv(&run_trailer.args, trailer_args.v);
|
||||
run_trailer.git_cmd = 1;
|
||||
if (run_command(&run_trailer))
|
||||
if (amend_file_with_trailers(git_path_commit_editmsg(), &trailer_args))
|
||||
die(_("unable to pass trailers to --trailers"));
|
||||
strvec_clear(&trailer_args);
|
||||
}
|
||||
@ -1672,7 +1658,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", &trailer_args, N_("trailer"), N_("add custom trailer(s)"), PARSE_OPT_NONEG, opt_pass_trailer),
|
||||
OPT_PASSTHRU_ARGV(0, "trailer", &trailer_args, N_("trailer"), N_("add custom trailer(s)"), PARSE_OPT_NONEG),
|
||||
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")),
|
||||
|
Reference in New Issue
Block a user