]> git.wh0rd.org - home.git/blame - .bin/diff-highlight
cros-board: update
[home.git] / .bin / diff-highlight
CommitLineData
a1c9eda1
MF
1#!/bin/sh
2
3set -e
4
5SCRIPT="$(readlink -f "$0")"
6TARGET="${SCRIPT}.real"
7
8main() {
9 # Some (old?) versions of git provided the compiled script.
10 d="/usr/share/doc/git/contrib/diff-highlight"
11 if [ -x "${d}/diff-highlight" ] ; then
12 exec "${d}/diff-highlight"
13 fi
14
15 # See if we need to bootstrap first.
16 if [ ! -x "${TARGET}" ] && [ -e "${d}" ] ; then
17 (
18 echo "#!/usr/bin/env perl"
19 cat "${d}/DiffHighlight.pm" "${d}/diff-highlight.perl"
20 ) >"${TARGET}"
21 chmod a+rx "${TARGET}"
22 fi
23
24 # If we've already bootstrapped, use it.
25 if [ -x "${TARGET}" ] ; then
26 exec "${TARGET}" "$@"
3dd171ff
MF
27 elif [ -x "/usr/bin/diff-highlight" ] ; then
28 exec /usr/bin/diff-highlight "$@"
a1c9eda1
MF
29 else
30 # Fallback so .gitconfig setings always work.
31 exec cat
32 fi
33}
34
35main "$@"