Subject: Re: [PATCH] meson: disable PCRE2 dependency by default

From: Junio C Hamano <[email-masked]>
Date: Mon, 14 Jul 2025 09:58:29 -0700

Carlo Marcelo Arenas Belón <[email-masked]> writes:

> This part was more of a: let's assume that we enable PCRE2 by default
> in the Makefile as well, what is the impact to the libification
> efforts now that there is a chance that libgit will be linked (probably
> statically if using meson) with libpcre2?
>
> Since the plan you mentioned above is still dreamware, wouldn't it be
> better to move all the pcre2 functions out of grep.c, export them back
> to it through a semi private header and convert `git-grep` into a
> standalone binary that might link with pcre2 as needed?

The engineering effort that such a move (and encapsulation of
"grep_pat" that may or may not have pcre enabled) would go quite a
long way and brings us quite a lot close to that "dreamware", I
suspect.  So it may not be a bad thing.

But even if you move code out of grep.c to a new "abstracted regcomp
and regexec that may or may not use pcre" source file, "git grep"
would need to run with the code you move to the latter anyway, so
unless your plan for libified "git grep" engine is to make the
library user responsible for supplying their own "abstracted regcomp
and regexec that may or may not use pcre" (and "git grep" brings in
its own in that new file), I do not know it changes the picture all
that much.

Thanks.