Subject: Re: [PATCH] execv_git_cmd(): also try PATH if everything else fails.

From: Andreas Ericsson <[email-masked]>
Date: Tue, 23 Oct 2007 13:12:03 +0200

Johannes Sixt wrote:
> Andreas Ericsson schrieb:
>> Scott Parish wrote:
>>> I'm tempted to try a different approach. What if instead of looping
>>> and building up strings of all the different absolute paths we want
>>> to try we just prepend to PATH with the correct extra precedence,
>>> and then call execvp on the command we want?
>>>
>>
>> That's how the original git --exec-dir feature got implemented. 
>> There's even a nifty function for it in git.c; prepend_to_path(). It's 
>> a provably workable solution.
> 
> The reason that this was done is for the sake of shell scripts: They 
> need to have the path that was finally decided as exec-path in $PATH.
> 
> But I can't think of any negative side effect if *all* exec-path 
> candidates are in $PATH. It's important, though, that all paths are 
> absolute because the tools chdir every now and then.
> 

So long as they're added in "success:failed:failed" order, I don't see
any issues either. Assuming we stop prepending once we find something
that works, that should be a non-issue.

-- 
Andreas Ericsson                   [email-masked]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231