Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-22 20:29:07 +0300
committerJunio C Hamano <gitster@pobox.com>2017-08-22 20:29:07 +0300
commit5c3895dfbd24a5ea23a8899ac40730359a6b2613 (patch)
treee3f3a7813ee6e63eafe9f320de8eb288c230f180 /builtin
parent5498d6961efdd32665b012d48a7fb8d1554c1643 (diff)
parent735285b403ee2b09c03d31f2dc8cc95a2d471ead (diff)
Merge branch 'pw/am-signoff'
"git am -s" has been taught that some input may end with a trailer block that is not Signed-off-by: and it should refrain from adding an extra blank line before adding a new sign-off in such a case. * pw/am-signoff: am: fix signoff when other trailers are present
Diffstat (limited to 'builtin')
-rw-r--r--builtin/am.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/builtin/am.c b/builtin/am.c
index ff0869d46f..81095dae02 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1193,34 +1193,10 @@ static void NORETURN die_user_resolve(const struct am_state *state)
*/
static void am_append_signoff(struct am_state *state)
{
- char *cp;
- struct strbuf mine = STRBUF_INIT;
struct strbuf sb = STRBUF_INIT;
strbuf_attach(&sb, state->msg, state->msg_len, state->msg_len);
-
- /* our sign-off */
- strbuf_addf(&mine, "\n%s%s\n",
- sign_off_header,
- fmt_name(getenv("GIT_COMMITTER_NAME"),
- getenv("GIT_COMMITTER_EMAIL")));
-
- /* Does sb end with it already? */
- if (mine.len < sb.len &&
- !strcmp(mine.buf, sb.buf + sb.len - mine.len))
- goto exit; /* no need to duplicate */
-
- /* Does it have any Signed-off-by: in the text */
- for (cp = sb.buf;
- cp && *cp && (cp = strstr(cp, sign_off_header)) != NULL;
- cp = strchr(cp, '\n')) {
- if (sb.buf == cp || cp[-1] == '\n')
- break;
- }
-
- strbuf_addstr(&sb, mine.buf + !!cp);
-exit:
- strbuf_release(&mine);
+ append_signoff(&sb, 0, 0);
state->msg = strbuf_detach(&sb, &state->msg_len);
}