Subject: Re: [PATCH] grep: do not do external grep on skip-worktree entries

From: Junio C Hamano <[email-masked]>
Date: Sun, 03 Jan 2010 21:52:10 -0800

Jeff King <[email-masked]> writes:

> On Sun, Jan 03, 2010 at 12:49:15PM -0800, Junio C Hamano wrote:
>
>> Linus Torvalds <[email-masked]> writes:
>> 
>> > Which means that if you put /usr/xpg4/bin before other paths in your PATH, 
>> > you'll totally break such systems, because now you get the (inferior) 
>> > tools in xpg4 before the preferred tools in /usr/local. Or - this also 
>> > happens - people end up installing their own versions in $HOME/bin, 
>> > because the system admin is uncaring or incompetent.
>> 
>> The build allows you to define SANE_TOOL_PATH ("the tools found in here
>> are saner than the ones in /usr/bin or /bin" is what it means) and we
>> insert it just in front of /usr/bin or /bin in the original PATH (see
>> git_brokne_path_fix in git-sh-setup.sh).
>> 
>> I would call this the right thing (TM) or the best workaround we could do
>> under the constraints, depending on the mood.
>
> I agree that Solaris default tools are insane, but is there any reason
> to munge the PATH for a single feature like external grep? Why not
> EXTERNAL_GREP=/usr/xpg4/bin/grep (or /usr/local/bin/grep) in the
> Makefile? Why not GIT_EXTERNAL_GREP=$HOME/bin/grep in the environment?

That git-sh-setup "fix" is not for running external grep.  It is for our
scripted Porcelains that rely on working basic tools (sed, tr, who knows
what else is broken).

In fact, our Makefile by default punts on external grep on Sun's.  Run
"git grep NO_EXTERNAL_GREP -- Makefile" to see for yourself --- it would
work even on Solaris ;-)

> Obviously we still need SANE_TOOL_PATH for systems where the /usr/bin is
> so crappy as to be unusable for our scripts. But surely we can do better
> for individual tools where the user might have some more specific
> preference about which tool he uses.
>
> -Peff