lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msysGit] [PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures
- Date: Thu, 3 Jul 2008 12:08:58 +0100 (BST)
- From: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
- Subject: Re: [msysGit] [PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures
Hi,
On Wed, 2 Jul 2008, Johannes Sixt wrote:
> On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote:
> > From: Johannes Schindelin <johannes.schindelin@xxxxxx>
> >
> > 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.
> >
> > [ spr: ported code to use strbuf ]
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> > Signed-off-by: Steffen Prohaska <prohaska@xxxxxx>
> > ---
> > builtin-tag.c | 14 ++++++++++++++
> > 1 files changed, 14 insertions(+), 0 deletions(-)
> >
> > diff --git a/builtin-tag.c b/builtin-tag.c
> > index e675206..77977ba 100644
> > --- a/builtin-tag.c
> > +++ b/builtin-tag.c
> > @@ -241,6 +241,20 @@ static int do_sign(struct strbuf *buffer)
> > if (finish_command(&gpg) || !len || len < 0)
> > return error("gpg failed to sign the tag");
> >
> > +#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;
> > }
>
> Do we need the #ifdef __MINGW32__? Can't we just strip CRs unconditionally? It
> shouldn't hurt on Unix anyway.
I agree, and I would even like to refactor this into its own function.
Probably even move it to strbuf.[ch].
Ciao,
Dscho
--
To unsubscribe from this list: 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