Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am supported the --signoff option which will append a signoff at the end of the commit messsage. Re-implement this feature by calling append_signoff() if the option is set. Signed-off-by: Paul Tan <pyokagan@xxxxxxxxx> --- builtin/am.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index 1807d12..d45dd41 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -18,6 +18,7 @@ #include "diffcore.h" #include "unpack-trees.h" #include "branch.h" +#include "sequencer.h" /** * Returns 1 if the file is empty or does not exist, 0 otherwise. @@ -71,6 +72,8 @@ struct am_state { int quiet; + int sign; + /* override error message when patch failure occurs */ const char *resolvemsg; }; @@ -292,6 +295,9 @@ static void am_load(struct am_state *state) read_state_file(&sb, am_path(state, "quiet"), 2, 1); state->quiet = !strcmp(sb.buf, "t"); + read_state_file(&sb, am_path(state, "sign"), 2, 1); + state->sign = !strcmp(sb.buf, "t"); + strbuf_release(&sb); } @@ -477,6 +483,8 @@ static void am_setup(struct am_state *state, enum patch_format patch_format, write_file(am_path(state, "quiet"), 1, state->quiet ? "t" : "f"); + write_file(am_path(state, "sign"), 1, state->sign ? "t" : "f"); + if (!get_sha1("HEAD", curr_head)) { write_file(am_path(state, "abort-safety"), 1, "%s", sha1_to_hex(curr_head)); update_ref("am", "ORIG_HEAD", curr_head, NULL, 0, UPDATE_REFS_DIE_ON_ERR); @@ -636,6 +644,9 @@ static int parse_patch(struct am_state *state, const char *patch) die_errno(_("could not read '%s'"), am_path(state, "msg")); stripspace(&state->msg, 0); + if (state->sign) + append_signoff(&state->msg, 0, 0); + return 0; } @@ -1007,6 +1018,8 @@ static const char * const am_usage[] = { static struct option am_options[] = { OPT__QUIET(&state.quiet, N_("be quiet")), + OPT_BOOL('s', "signoff", &state.sign, + N_("add a Signed-off-by line to the commit message")), OPT_CALLBACK(0, "patch-format", &opt_patch_format, N_("format"), N_("format the patch(es) are in"), parse_opt_patchformat), OPT_STRING(0, "resolvemsg", &state.resolvemsg, NULL, -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html