From: Andreas Ericsson Date: Mon, 22 Oct 2007 15:19:36 GMT Subject: Re: [PATCH] execv_git_cmd(): also try PATH if everything else fails. Message-ID: <471CBF88.6020300@op5.se> In-Reply-To: <20071022143637.GP16291@srparish.net> Scott Parish wrote: > On Sun, Oct 21, 2007 at 10:59:01PM +0100, Johannes Schindelin wrote: > >> Earlier, we tried to find the git commands in several possible exec >> dirs. Now, if all of these failed, try to find the git command in >> PATH. > > 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. -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231