From: Brandon Casey Date: Mon, 08 Jun 2009 23:39:40 GMT Subject: Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Message-ID: In-Reply-To: <20090608221117.GC29942@sigill.intra.peff.net> I never received the referenced email. I'll try to extract from gmane and test. -brandon Jeff King wrote: > On Mon, Jun 08, 2009 at 09:41:49AM -0700, Junio C Hamano wrote: > >> We could further uglify the patch like this. >> [...] >> +git_broken_path_fix () { >> + case ":$PATH:" in >> + *:$1:*) : ok ;; >> + *) >> + PATH=$( >> + SANE_TOOL_PATH="$1" >> + IFS=: path= sep= >> + set x $PATH >> + shift >> + for elem >> + do >> + case "$SANE_TOOL_PATH:$elem" in >> + (?*:/bin | ?*:/usr/bin) >> + path="$path$sep$SANE_TOOL_PATH" >> + sep=: >> + SANE_TOOL_PATH= >> + esac >> + path="$path$sep$elem" >> + sep=: >> + done >> + echo "$path" >> + ) >> + ;; >> + esac >> +} > > Wow. That _is_ ugly, but it actually addresses exactly both my concern > and Brandon's. I kind of like it. > > -Peff