diff options
-rw-r--r-- | builtin-tag.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-tag.c b/builtin-tag.c index 3c97c696a5..a70922b21c 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -202,6 +202,7 @@ static int do_sign(struct strbuf *buffer) const char *args[4]; char *bracket; int len; + int i, j; if (!*signingkey) { if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME), @@ -241,6 +242,15 @@ static int do_sign(struct strbuf *buffer) if (finish_command(&gpg) || !len || len < 0) return error("gpg failed to sign the tag"); + /* Strip CR from the line endings, in case we are on Windows. */ + for (i = j = 0; i < buffer->len; i++) + if (buffer->buf[i] != '\r') { + if (i != j) + buffer->buf[j] = buffer->buf[i]; + j++; + } + strbuf_setlen(buffer, j); + return 0; } |