Junio C Hamano wrote: > > Haven't checked the code around the patch yet, but does it work > when the original commit log message ends with a blank line and > existing signed-off-by lines by other people? You do not want > an extra blank lines there. > argh, no I just tested the previous case. Here is an update which fix all cases. -- >8 -- [PATCH] Add a newline before appending "Signed-off-by:" It looks nicer. Signed-off-by: Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> --- log-tree.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/log-tree.c b/log-tree.c index 9d8d46f..69d5c8a 100644 --- a/log-tree.c +++ b/log-tree.c @@ -17,9 +17,10 @@ static int append_signoff(char *buf, int int signoff_len = strlen(signoff); static const char signed_off_by[] = "Signed-off-by: "; char *cp = buf; + int has_signoff = 0; /* Do we have enough space to add it? */ - if (buf_sz - at <= strlen(signed_off_by) + signoff_len + 2) + if (buf_sz - at <= strlen(signed_off_by) + signoff_len + 3) return at; /* First see if we already have the sign-off by the signer */ @@ -32,8 +33,11 @@ static int append_signoff(char *buf, int !strncmp(cp, signoff, signoff_len) && isspace(cp[signoff_len])) return at; /* we already have him */ + has_signoff = 1; } + if (!has_signoff) + buf[at++] = '\n'; strcpy(buf + at, signed_off_by); at += strlen(signed_off_by); strcpy(buf + at, signoff); -- 1.4.1.g55b7 - : 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