Skip to content

Commit

Permalink
cherry-pick: add --action-name option
Browse files Browse the repository at this point in the history
So it can be used by other tools (e.g. git rebase), and the right action
is passed to the hooks and notes rewrite stuff.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information
felipec committed May 18, 2016
1 parent fcdd4af commit a0305be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
OPT_END(),
OPT_END(),
OPT_END(),
OPT_END(),
};

if (opts->action == REPLAY_PICK) {
Expand All @@ -111,6 +112,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
OPT_BOOL(0, "allow-empty-message", &opts->allow_empty_message, N_("allow commits with empty messages")),
OPT_BOOL(0, "keep-redundant-commits", &opts->keep_redundant_commits, N_("keep redundant, empty commits")),
OPT_BOOL(0, "skip-empty", &opts->skip_empty, N_("skip empty commits")),
OPT_STRING(0, "action-name", &opts->action_name, N_("name"), N_("action name")),
OPT_END(),
};
if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))
Expand Down
4 changes: 4 additions & 0 deletions sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
opts->xopts[opts->xopts_nr++] = xstrdup(value);
} else if (!strcmp(key, "options.allow-rerere-auto"))
opts->allow_rerere_auto = git_config_int(key, value);
else if (!strcmp(key, "options.action-name"))
git_config_string(&opts->action_name, key, value);
else
return error(_("Invalid key: %s"), key);

Expand Down Expand Up @@ -992,6 +994,8 @@ static void save_opts(struct replay_opts *opts)
git_config_set_in_file(opts_file, "options.allow-rerere-auto", buf.buf);
strbuf_release(&buf);
}
if (opts->action_name)
git_config_set_in_file(opts_file, "options.action-name", opts->action_name);
}

static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)
Expand Down
2 changes: 2 additions & 0 deletions sequencer.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ struct replay_opts {

/* Only used by REPLAY_NONE */
struct rev_info *revs;

const char *action_name;
};

int sequencer_pick_revisions(struct replay_opts *opts);
Expand Down

0 comments on commit a0305be

Please sign in to comment.