Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-25 Thread Kevin Daudt
On Mon, Sep 26, 2016 at 12:38:42AM +0200, Jakub Narębski wrote: > W dniu 25.09.2016 o 22:17, Kevin Daudt pisze: > > On Fri, Sep 23, 2016 at 12:15:41AM -0400, Jeff King wrote: > > >> Oops, yes. It is beginning to make the "strbuf_swap()" look less > >> convoluted. :) > >> > > > > I've switched to

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-25 Thread Jakub Narębski
W dniu 25.09.2016 o 22:17, Kevin Daudt pisze: > On Fri, Sep 23, 2016 at 12:15:41AM -0400, Jeff King wrote: >> Oops, yes. It is beginning to make the "strbuf_swap()" look less >> convoluted. :) >> > > I've switched to strbuf_swap now, much better. I've implemented > recursive parsing without looki

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-25 Thread Kevin Daudt
On Fri, Sep 23, 2016 at 12:15:41AM -0400, Jeff King wrote: > On Thu, Sep 22, 2016 at 03:17:23PM -0700, Junio C Hamano wrote: > > > Jeff King writes: > > > > > On Mon, Sep 19, 2016 at 08:54:40PM +0200, Kevin Daudt wrote: > > > > > >> + ... > > >> +while ((c = *in++) != 0) { > > >> +

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-22 Thread Jeff King
On Thu, Sep 22, 2016 at 03:17:23PM -0700, Junio C Hamano wrote: > Jeff King writes: > > > On Mon, Sep 19, 2016 at 08:54:40PM +0200, Kevin Daudt wrote: > > > >> + ... > >> + while ((c = *in++) != 0) { > >> + if (take_next_literally) { > >> + take_next_literally = 0; > >

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-22 Thread Junio C Hamano
Jeff King writes: > On Mon, Sep 19, 2016 at 08:54:40PM +0200, Kevin Daudt wrote: > >> + ... >> +while ((c = *in++) != 0) { >> +if (take_next_literally) { >> +take_next_literally = 0; >> +} else { >> [...] >> +} >> + >> +strbu

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-21 Thread Jeff King
On Mon, Sep 19, 2016 at 08:54:40PM +0200, Kevin Daudt wrote: > diff --git a/mailinfo.c b/mailinfo.c > index e19abe3..6a7c2f2 100644 > --- a/mailinfo.c > +++ b/mailinfo.c > @@ -54,6 +54,50 @@ static void parse_bogus_from(struct mailinfo *mi, const > struct strbuf *line) > get_sane_name(&mi->

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-19 Thread Jeff King
On Mon, Sep 19, 2016 at 08:54:40PM +0200, Kevin Daudt wrote: > diff --git a/t/t5100/comment.expect b/t/t5100/comment.expect > new file mode 100644 > index 000..1197e76 > --- /dev/null > +++ b/t/t5100/comment.expect > @@ -0,0 +1,5 @@ > +Author: A U Thor (this is a comment (really)) Hmm. I don'

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-19 Thread Junio C Hamano
Junio C Hamano writes: > Kevin Daudt writes: > >> +static void unquote_quoted_string(struct strbuf *line) >> +{ >> +const char *in = strbuf_detach(line, NULL); >> +int c, take_next_literally = 0; >> +int found_error = 0; > ... >> +} >> +} > > The additional comment makes it very

Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-19 Thread Junio C Hamano
Kevin Daudt writes: > +static void unquote_quoted_string(struct strbuf *line) > +{ > + const char *in = strbuf_detach(line, NULL); > + int c, take_next_literally = 0; > + int found_error = 0; > + > + /* > + * Stores the character that started the escape mode so that we know

[PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields

2016-09-19 Thread Kevin Daudt
rfc2822 has provisions for quoted strings in structured header fields, but also allows for escaping these with so-called quoted-pairs. The only thing git currently does is removing exterior quotes, but quotes within are left alone. Remove exterior quotes and remove escape characters so that they