Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: [PATCH v3] Re: git-am: fix maildir support regression: accept email file as patch

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:03

Possibly related (same subject, not in this thread)

Nicolas Sebrecht [off-list ref] writes:
I don't see the reason to have the option -v. It's only related to
what's printed to output and doesn't change the exit status which
tell us if an expression has matched.

This gives:

   grep -E -e '^[A-Za-z]+(-[A-Za-z]+)*:' >/dev/null &&
   patch_format=mbox
That grep says "if you see a single line that matches the pattern, even if
all the other lines are garbage, report it as a match".

See "something like this" patch in my other message. It filters the entire
header to make sure there is no line that does not match (that is what -v
is about), and make it report success when there is even a signle line
that does not.

    $ (echo yes; echo no) | grep -v -e yes ; echo $?
    no
    0
    $ (echo yes; echo yes) | grep -v -e yes ; echo $?
    1

That is why I wrote the "how about this" patch with "||" like this:

    grep -v -E -e '^[A-Za-z]+(-[A-Za-z]+)*:' >/dev/null ||
    patch_format=mbox

If everything is header, grep says "nothing matches", and patch_format
is set to mbox.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help