From a1c9eda1a7e269d67f395d007f756209edbe8acc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 10 Nov 2020 03:50:45 -0500 Subject: [PATCH] diff-highlight: handle newer git versions It seems git has stopped providing this tool precompiled, so we have to build it up ourselves. --- .bin/diff-highlight | 33 +++++++++++++++++++++++++++++++++ .gitignore | 2 ++ 2 files changed, 35 insertions(+) create mode 100755 .bin/diff-highlight 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 -- 2.39.2