From 0ed5d28283854fc47f130d65f6b658398eef80d8 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 3 Sep 2007 17:36:47 +0100 Subject: [PATCH] MinGW: Convert CR/LF to LF in tag signatures On Windows, gpg outputs CR/LF signatures. But since the tag messages are already stripped of the CR by stripspace(), it is arguably nicer to do the same for the tag signature. Actually, this patch does not look for CR/LF, but strips all CRs from the signature. [ sp: ported code to use strbuf ] Signed-off-by: Johannes Schindelin Signed-off-by: Steffen Prohaska --- builtin-tag.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/builtin-tag.c b/builtin-tag.c index 66e5a58307..ae8538897b 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -224,6 +224,20 @@ static int do_sign(struct strbuf *buffer) if (len < 0) return error("could not read the entire signature from gpg."); +#ifdef __MINGW32__ + /* strip CR from the line endings */ + { + int i, j; + 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); + } +#endif + return 0; }