From: Mike Frysinger Date: Tue, 10 Nov 2020 08:50:45 +0000 (-0500) Subject: diff-highlight: handle newer git versions X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a1c9eda1a7e269d67f395d007f756209edbe8acc;p=home.git diff-highlight: handle newer git versions It seems git has stopped providing this tool precompiled, so we have to build it up ourselves. --- diff --git a/.bin/diff-highlight b/.bin/diff-highlight new file mode 100755 index 0000000..940d802 --- /dev/null +++ b/.bin/diff-highlight @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +SCRIPT="$(readlink -f "$0")" +TARGET="${SCRIPT}.real" + +main() { + # Some (old?) versions of git provided the compiled script. + d="/usr/share/doc/git/contrib/diff-highlight" + if [ -x "${d}/diff-highlight" ] ; then + exec "${d}/diff-highlight" + fi + + # See if we need to bootstrap first. + if [ ! -x "${TARGET}" ] && [ -e "${d}" ] ; then + ( + echo "#!/usr/bin/env perl" + cat "${d}/DiffHighlight.pm" "${d}/diff-highlight.perl" + ) >"${TARGET}" + chmod a+rx "${TARGET}" + fi + + # If we've already bootstrapped, use it. + if [ -x "${TARGET}" ] ; then + exec "${TARGET}" "$@" + else + # Fallback so .gitconfig setings always work. + exec cat + fi +} + +main "$@" diff --git a/.gitignore b/.gitignore index 7f95ddf..df28d59 100644 --- a/.gitignore +++ b/.gitignore @@ -412,7 +412,9 @@ lock # per-system files /.asoundrc +/.bin/diff-highlight.real /.bin/gsutil +/.bin/repo* /.boto* /.chrome-remote-desktop-session /.forward