summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-08-24 10:20:01 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-08-24 10:20:02 -0700
commitbdfc15fb21328a1461191863777583d32c034077 (patch)
tree7443285d2b5a32d810f2e94aa68e1cd73572f8e1 /builtin/merge.c
parentSync with maint (diff)
parentmerge: add a --signoff flag (diff)
downloadtgif-bdfc15fb21328a1461191863777583d32c034077.tar.xz
Merge branch 'lg/merge-signoff'
"git merge" learned a "--signoff" option to add the Signed-off-by: trailer with the committer's name. * lg/merge-signoff: merge: add a --signoff flag
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 328945d609..cc57052993 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -70,6 +70,7 @@ static int continue_current_merge;
static int allow_unrelated_histories;
static int show_progress = -1;
static int default_to_upstream = 1;
+static int signoff;
static const char *sign_commit;
static struct strategy all_strategy[] = {
@@ -233,6 +234,7 @@ static struct option builtin_merge_options[] = {
{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
+ OPT_BOOL(0, "signoff", &signoff, N_("add Signed-off-by:")),
OPT_END()
};
@@ -763,6 +765,8 @@ static void prepare_to_commit(struct commit_list *remoteheads)
strbuf_addch(&msg, '\n');
if (0 < option_edit)
strbuf_commented_addf(&msg, _(merge_editor_comment), comment_line_char);
+ if (signoff)
+ append_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);
write_file_buf(git_path_merge_msg(), msg.buf, msg.len);
if (run_commit_hook(0 < option_edit, get_index_file(), "prepare-commit-msg",
git_path_merge_msg(), "merge", NULL))