Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
- From
Jeff King <peff@peff.net>
- Date
- Jun 8, 2009, 22:11 UTC
- Message-ID
- <20090608221117.GC29942@sigill.intra.peff.net>
- In-Reply-To
- <7v4ouq1xv6.fsf@alter.siamese.dyndns.org>
On Mon, Jun 08, 2009 at 09:41:49AM -0700, Junio C Hamano wrote:
Show 27 quoted lines
> 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