Re: Mailsplit

2018-09-07 Thread Stephen & Linda Smith
On Friday, September 7, 2018 8:15:43 AM MST Kevin Daudt wrote: > On Wed, Sep 05, 2018 at 09:17:29PM -0700, Stephen & Linda Smith wrote: > > This is the mailsplit command, and should be executed when running `git > mailsplit`. What does git --exec-dir return? > The other ni

Re: Mailsplit

2018-09-07 Thread Kevin Daudt
On Wed, Sep 05, 2018 at 09:17:29PM -0700, Stephen & Linda Smith wrote: > I thought I would use "git mailsplit" to split a mbox file (which downloaded > from public inbox) so that I could attemp to resurrect a patch series for > from > a year ago. > > The mot

Re: Mailsplit

2018-09-05 Thread Stephen & Linda Smith
On Wednesday, September 5, 2018 9:17:29 PM MST Stephen & Linda Smith wrote: > So two questions: > 1) why would git version 2.18.0 not appear to continue applying the > patches. > > 2) where do I find the command "git mailsplit". The onlything in my > ins

Mailsplit

2018-09-05 Thread Stephen & Linda Smith
I thought I would use "git mailsplit" to split a mbox file (which downloaded from public inbox) so that I could attemp to resurrect a patch series for from a year ago. The motivation is that I downloaded the series [1] and applied to a tag from about the time period that the patc

[PATCH v4 09/25] mailinfo & mailsplit: check for EOF while parsing

2017-05-04 Thread Johannes Schindelin
While POSIX states that it is okay to pass EOF to isspace() (and it seems to be implied that EOF should *not* be treated as whitespace), and also to pass EOF to ungetc() (which seems to be intended to fail without buffering the character), it is much better to handle these cases explicitly. Not onl

[PATCH v3 09/25] mailinfo & mailsplit: check for EOF while parsing

2017-05-02 Thread Johannes Schindelin
While POSIX states that it is okay to pass EOF to isspace() (and it seems to be implied that EOF should *not* be treated as whitespace), and also to pass EOF to ungetc() (which seems to be intended to fail without buffering the character), it is much better to handle these cases explicitly. Not onl

Re: [PATCH v2 09/25] mailinfo & mailsplit: check for EOF while parsing

2017-05-02 Thread Johannes Schindelin
Hi Junio, On Mon, 1 May 2017, Junio C Hamano wrote: > Johannes Schindelin writes: > > > diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c > > index 30681681c13..9b3efc8e987 100644 > > --- a/builtin/mailsplit.c > > +++ b/builtin/mailsplit.c > > @@ -233,7 +233,8 @@ static int split_mbox(cons

Re: [PATCH v2 09/25] mailinfo & mailsplit: check for EOF while parsing

2017-05-01 Thread Junio C Hamano
Johannes Schindelin writes: > While POSIX states that it is okay to pass EOF to isspace() (and it seems > to be implied that EOF should *not* be treated as whitespace), and also to > pass EOF to ungetc() (which seems to be intended to fail without buffering > the character), it is much better to

[PATCH v2 09/25] mailinfo & mailsplit: check for EOF while parsing

2017-04-28 Thread Johannes Schindelin
While POSIX states that it is okay to pass EOF to isspace() (and it seems to be implied that EOF should *not* be treated as whitespace), and also to pass EOF to ungetc() (which seems to be intended to fail without buffering the character), it is much better to handle these cases explicitly. Not onl

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-25 Thread Eric Wong
, as it only reads from the > mbox "From " line to learn the > original commit and extract the log message directly from there. OK. > But a third-party script that wants to read format-patch output > would be forced to upgrade, which is a pain if we make this change > unco

Re: [PATCH 1/2] mailinfo: extract is_from_line from mailsplit

2016-07-25 Thread Junio C Hamano
Andreas Schwab writes: >> +colon = line + len - 2; >> +line += 5; >> +for (;;) { >> +if (colon < line) >> +return 0; >> +if (*--colon == ':') >> +break; >> +} >> + >> +if (!isdigit(colon[-4]) || >> +!isdig

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-25 Thread Junio C Hamano
Eric Wong writes: >> Also, doesn't it break "git rebase" (non-interactive), or anything >> that internally runs format-patch to individual files and then runs >> am on each of them, anything that knows that each output file from >> format-patch corresponds to a single change and there is no need

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-25 Thread Eric Wong
ne uses mboxrd, yet, we should at least > >> prevent miss-split mails by always escaping "From " lines based > >> on the check used by mailsplit. > >> > >> mailsplit will not perform unescaping by default, yet, as it > >> could cause furth

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-24 Thread Junio C Hamano
vent miss-split mails by always escaping "From " lines based >> on the check used by mailsplit. >> >> mailsplit will not perform unescaping by default, yet, as it >> could cause further invocations of format-patch from old >> versions of git to generate ba

Re: [PATCH 2/2] format-patch: escape "From " lines recognized by mailsplit

2016-07-24 Thread Jeff King
On Sun, Jul 24, 2016 at 09:37:57AM +0200, Johannes Schindelin wrote: > On Sun, 24 Jul 2016, Eric Wong wrote: > > > @@ -1745,9 +1746,18 @@ void pp_remainder(struct pretty_print_context *pp, > > strbuf_add_tabexpand(sb, pp->expand_tabs_in_log, > >

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-24 Thread Eric Wong
Junio C Hamano wrote: > As a tool to produce mbox file, quoting like this in format-patch > output may make sense, I would think, but shouldn't send-email undo > this when sending individual patches? Yes, that sounds like a good idea. Thanks. Will followup in a day or two. -- To unsubscribe from

Re: [PATCH 1/2] mailinfo: extract is_from_line from mailsplit

2016-07-24 Thread Andreas Schwab
Johannes Schindelin writes: > Hi Andreas, > > On Sun, 24 Jul 2016, Andreas Schwab wrote: > >> Eric Wong writes: >> >> > diff --git a/mailinfo.c b/mailinfo.c >> > index 9f19ca1..0ebd953 100644 >> > --- a/mailinfo.c >> > +++ b/mailinfo.c >> > @@ -1035,3 +1035,34 @@ void clear_mailinfo(struct mail

Re: [PATCH 1/2] mailinfo: extract is_from_line from mailsplit

2016-07-24 Thread Johannes Schindelin
Hi Andreas, On Sun, 24 Jul 2016, Andreas Schwab wrote: > Eric Wong writes: > > > diff --git a/mailinfo.c b/mailinfo.c > > index 9f19ca1..0ebd953 100644 > > --- a/mailinfo.c > > +++ b/mailinfo.c > > @@ -1035,3 +1035,34 @@ void clear_mailinfo(struct mailinfo *mi) > > > > strbuf_release(&mi-

Re: [PATCH 2/2] format-patch: escape "From " lines recognized by mailsplit

2016-07-24 Thread Johannes Schindelin
Hi Eric, On Sun, 24 Jul 2016, Eric Wong wrote: > @@ -1745,9 +1746,18 @@ void pp_remainder(struct pretty_print_context *pp, > strbuf_add_tabexpand(sb, pp->expand_tabs_in_log, >line, linelen); > else { > -

Re: [PATCH 1/2] mailinfo: extract is_from_line from mailsplit

2016-07-24 Thread Andreas Schwab
Eric Wong writes: > diff --git a/mailinfo.c b/mailinfo.c > index 9f19ca1..0ebd953 100644 > --- a/mailinfo.c > +++ b/mailinfo.c > @@ -1035,3 +1035,34 @@ void clear_mailinfo(struct mailinfo *mi) > > strbuf_release(&mi->log_message); > } > + > +int is_from_line(const char *line, int len) >

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-24 Thread Junio C Hamano
quot; lines based > on the check used by mailsplit. > > mailsplit will not perform unescaping by default, yet, as it > could cause further invocations of format-patch from old > versions of git to generate bad output. Propagating the mboxo > escaping is preferable to miss-split

[PATCH 1/2] mailinfo: extract is_from_line from mailsplit

2016-07-23 Thread Eric Wong
.h" +#include "mailinfo.h" static const char git_mailsplit_usage[] = "git mailsplit [-d] [-f] [-b] [--keep-cr] -o [(|)...]"; -static int is_from_line(const char *line, int len) -{ - const char *colon; - - if (len < 20 || memcmp("From ", line,

[PATCH 2/2] format-patch: escape "From " lines recognized by mailsplit

2016-07-23 Thread Eric Wong
Users have mistakenly copied "From " lines into commit messages in the past, and will certainly make the same mistakes in the future. Since not everyone uses mboxrd, yet, we should at least prevent miss-split mails by always escaping "From " lines based on the check used by m

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-23 Thread Eric Wong
Johannes Schindelin wrote: > I think that this change: > deserves to live in a separate patch... It would make the real change > stick out better. Good point, I actually wrote a looser check based on is_mboxrd_from before realizing the stricter check from mailsplit would probabl

Re: [PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-23 Thread Johannes Schindelin
; > #include "string-list.h" > #include "strbuf.h" > +#include "mailinfo.h" > > static const char git_mailsplit_usage[] = > "git mailsplit [-d] [-f] [-b] [--keep-cr] -o > [(|)...]"; > > -static int is_from_line(const char *lin

[PATCH] format-patch: escape "From " lines recognized by mailsplit

2016-07-22 Thread Eric Wong
Users have mistakenly copied "From " lines into commit messages in the past, and will certainly make the same mistakes in the future. Since not everyone uses mboxrd, yet, we should at least prevent miss-split mails by always escaping "From " lines based on the check used by m

Re: [PATCH v2 2/3] mailsplit: support unescaping mboxrd messages

2016-06-06 Thread Eric Wong
Junio C Hamano wrote: > This just makes me wonder if there is a practical reason why people > would not want this always enabled. I just looked at output from > > $ git log --grep='>>*From ' Missing '^' ? Auto-unescaping in mailsplit might throw

Re: [PATCH v2 2/3] mailsplit: support unescaping mboxrd messages

2016-06-06 Thread Junio C Hamano
00644 t/t5100/0001mboxrd > create mode 100644 t/t5100/0002mboxrd > create mode 100644 t/t5100/sample.mboxrd > > diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt > index 4d1b871..e3b2a88 100644 > --- a/Documentation/git-mailsplit.txt > +++ b/Doc

[PATCH v2 2/3] mailsplit: support unescaping mboxrd messages

2016-06-04 Thread Eric Wong
t/t5100/sample.mboxrd diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt index 4d1b871..e3b2a88 100644 --- a/Documentation/git-mailsplit.txt +++ b/Documentation/git-mailsplit.txt @@ -8,7 +8,8 @@ git-mailsplit - Simple UNIX mbox splitter program SYNOPSIS

[PATCH 2/3] mailsplit: support unescaping mboxrd messages

2016-05-30 Thread Eric Wong
/sample.mboxrd diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt index 4d1b871..e3b2a88 100644 --- a/Documentation/git-mailsplit.txt +++ b/Documentation/git-mailsplit.txt @@ -8,7 +8,8 @@ git-mailsplit - Simple UNIX mbox splitter program SYNOPSIS [verse] -

[PATCH 10/68] mailsplit: make PATH_MAX buffers dynamic

2015-09-24 Thread Jeff King
There are several PATH_MAX-sized buffers in mailsplit, along with some questionable uses of sprintf. These are not really of security interest, as local mailsplit pathnames are not typically under control of an attacker, and you could generally only overflow a few numbers at the end of a path

[PATCH 02/68] mailsplit: fix FILE* leak in split_maildir

2015-09-24 Thread Jeff King
If we encounter an error while splitting a maildir, we exit the function early, leaking the open filehandle. This isn't a big deal, since we exit the program soon after, but it's easy enough to be careful. Signed-off-by: Jeff King --- builtin/mailsplit.c | 5 - 1 file changed, 4 insertions(+

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Jeff King
On Wed, Sep 16, 2015 at 11:13:37AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > + free(file); > > + file = xstrfmt("%s/%s", maildir, list.items[i].string); > > Repeated pattern makes one wonder if a thin wrapper > > xstrfmt_to(&file, "%s/%s", maildir, list.i

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Junio C Hamano
Jeff King writes: > + free(file); > + file = xstrfmt("%s/%s", maildir, list.items[i].string); Repeated pattern makes one wonder if a thin wrapper xstrfmt_to(&file, "%s/%s", maildir, list.items[i].string); that first frees the existing value and then overwrites i

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Jeff King
is not too complicated, but it is not an idiom we use elsewhere (whereas recycled strbufs are). I can switch the whole thing to strbufs if that's the direction we want to go. -- >8 -- Subject: [PATCH] mailsplit: make PATH_MAX buffers dynamic There are several static PATH_MAX-sized bu

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Jeff King
On Tue, Sep 15, 2015 at 08:51:26PM -0400, Eric Sunshine wrote: > > if (strbuf_getwholeline(&buf, f, '\n')) { > > - error("cannot read mail %s (%s)", file, > > strerror(errno)); > > + error("cannot read mail %s (%s)", file.buf, > > strer

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-15 Thread Eric Sunshine
On Tue, Sep 15, 2015 at 11:28 AM, Jeff King wrote: > There are several static PATH_MAX-sized buffers in > mailsplit, along with some questionable uses of sprintf. > These are not really of security interest, as local > mailsplit pathnames are not typically under control of an > at

[PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-15 Thread Jeff King
There are several static PATH_MAX-sized buffers in mailsplit, along with some questionable uses of sprintf. These are not really of security interest, as local mailsplit pathnames are not typically under control of an attacker. But it does not hurt to be careful, and as a bonus we lift some

[PATCH 02/67] mailsplit: fix FILE* leak in split_maildir

2015-09-15 Thread Jeff King
If we encounter an error while splitting a maildir, we exit the function early, leaking the open filehandle. This isn't a big deal, since we exit the program soon after, but it's easy enough to be careful. Signed-off-by: Jeff King --- builtin/mailsplit.c | 5 - 1 file changed, 4 insertions(+

[PATCH v7 05/45] builtin-am: split out mbox/maildir patches with git-mailsplit

2015-08-04 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

[PATCH v6 05/45] builtin-am: split out mbox/maildir patches with git-mailsplit

2015-07-19 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

[PATCH v5 05/44] builtin-am: split out mbox/maildir patches with git-mailsplit

2015-07-07 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

[PATCH v4 05/44] builtin-am: split out mbox/maildir patches with git-mailsplit

2015-06-28 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

Re: [PATCH/WIP v3 05/31] am: split out mbox/maildir patches with git-mailsplit

2015-06-18 Thread Junio C Hamano
Paul Tan writes: > @@ -111,13 +122,69 @@ static void am_destroy(const struct am_state *state) > } > > /** > + * Splits out individual patches from `paths`, where each path is either a > mbox > + * file or a Maildir. Return 0 on success, -1 on failure. > + */ "Splits" and then "Return"? Be

[PATCH/WIP v3 05/31] am: split out mbox/maildir patches with git-mailsplit

2015-06-18 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

Re: [PATCH/WIP v2 05/19] am: split out mbox/maildir patches with git-mailsplit

2015-06-15 Thread Paul Tan
On Fri, Jun 12, 2015 at 1:45 AM, Stefan Beller wrote: > On Thu, Jun 11, 2015 at 3:21 AM, Paul Tan wrote: >> @@ -138,13 +202,33 @@ static void am_next(struct am_state *state) >> */ >> static void am_run(struct am_state *state) >> { >> - while (state->cur <= state->last) >> + while

Re: [PATCH/WIP v2 05/19] am: split out mbox/maildir patches with git-mailsplit

2015-06-11 Thread Stefan Beller
On Thu, Jun 11, 2015 at 3:21 AM, Paul Tan wrote: > git-am.sh supports mbox, stgit and mercurial patches. Re-implement > support for splitting out mbox/maildirs using git-mailsplit, while also > implementing the framework required to support other patch formats in > the future. >

[PATCH/WIP v2 05/19] am: split out mbox/maildir patches with git-mailsplit

2015-06-11 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

Re: [PATCH/WIP 4/8] am: split out mbox/maildir patches with git-mailsplit

2015-06-02 Thread Paul Tan
On Fri, May 29, 2015 at 7:05 AM, Eric Sunshine wrote: > On Wed, May 27, 2015 at 9:33 AM, Paul Tan wrote: >> @@ -128,13 +190,32 @@ static void am_next(struct am_state *state) >> */ >> +/** >> + * parse_options() callback that validates and sets opt->value to the >> + * PATCH_FORMAT_* enum value

Re: [PATCH/WIP 4/8] am: split out mbox/maildir patches with git-mailsplit

2015-05-28 Thread Eric Sunshine
On Wed, May 27, 2015 at 9:33 AM, Paul Tan wrote: > git-am.sh supports mbox, stgit and mercurial patches. Re-implement > support for splitting out mbox/maildirs using git-mailsplit, while also > implementing the framework required to support other patch formats in > the future. >

[PATCH/WIP 4/8] am: split out mbox/maildir patches with git-mailsplit

2015-05-27 Thread Paul Tan
git-am.sh supports mbox, stgit and mercurial patches. Re-implement support for splitting out mbox/maildirs using git-mailsplit, while also implementing the framework required to support other patch formats in the future. Re-implement support for the --patch-format option (since a5a6755 (git-am

[PATCH] mailsplit: remove unnecessary unlink(2) call

2014-10-04 Thread René Scharfe
The output file hasn't been created at this point, yet, so there is no need to delete it when exiting early. Suggested-by: Jeff King Signed-off-by: Rene Scharfe --- Original thread: http://thread.gmane.org/gmane.comp.version-control.git/255140 builtin/mailsplit.c | 1 - 1 file changed, 1 delet