On Mon, Apr 20, 2015 at 10:41 AM, Junio C Hamano <gits...@pobox.com> wrote:
>
> Ahh, OK.  And not just -S and -G, the "fields in headers" may be
> something user may want to switch independently?

So personally, I hate extra command line flags for this. I'd much
rather see is use something in the regular expression itself, and make
*that* be the way you do it, and make it be the preferred format.

Otherwise, you'll always have the issue that you want *part* to be
case-ignoring, and another entry not, and then it's just messy with
the "ignore case" being some other thing.

And we support that with perl regexps, but those are only enabled with
libpcre. I wonder if we could just make some simple pattern extension
that we make work even *without* libpcre.

IOW, instead of making people use "-regexp-ignore-case", could we just
say that we *always* support the syntax of appending "(?i)" in front
of the regexp. So that your

    git log --regexp-ignore-case --author=tiM --grep=wip

example would be

    git log --author="(?i)tiM" --grep=wip

and it would match the _author_ with ignoring case, but the
"--grep=wip" part would be an exact grep.

Right now the above already works (I think) if you:

 - build with USE_LIBPCRE

 - add that "--perl-regexp" switch.

but what I'm suggesting is that we'd make a special case for the
magical perl modifier pattern at the beginning for "(?i)", and make it
work even without USE_LIBPCRE, and without specifying "--perl-regexp".

We'd just special-case that pattern (and perhaps _only_ that special
four-byte sequence of "(?i)" at the beginning of the search string),
but perhaps we could support '(?s)' too?

Hmm? I realize that this would be theoretically an incompatible
change, but it would be very convenient and if we document it well it
might be ok. I doubt people really search for "(?i)" at the beginning
of strings _except_ if they already know about the perl syntax and
want it.

And to clarify: I don't suggest always building with libpcre. I
literally suggest having something like

     /* hacky mac-hack hack */
    if (strncmp("(?i)", p->pattern, 4)) {
        p->pattern += 4;
        p->ignore_case = true;
    }

just in front of the "regcomp() call, and nothing more fancy than that.

                           Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to