From 2dea149220a93633391546e242097956eaccf945 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 3 Jan 2023 10:38:01 -0800 Subject: [PATCH] Fetch diff-highlight build files from upstream This both removes the need to query for these files from the installation's source files (if even available--MacOS doesn't seem to have these present on the system at all) and ensures the latest version will be built. --- post-setup/diff-highlight.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/post-setup/diff-highlight.sh b/post-setup/diff-highlight.sh index 30e630d..aadda51 100755 --- a/post-setup/diff-highlight.sh +++ b/post-setup/diff-highlight.sh @@ -6,12 +6,19 @@ if type diff-highlight >/dev/null 2>&1; then return fi +REQUIRED_BUILD_FILES=( + Makefile + diff-highlight.perl + DiffHighlight.pm +) + # create temp directory pushd "$(mktemp -d)" >/dev/null -# copy the diff-highlight source files distributed with git to this temp -# directory and build it -cp -R --preserve=mode,timestamps "$(dpkg -L git | grep diff-highlight | head -1)"/* . +# fetch diff-highlight build files and build the binary +for file in "${REQUIRED_BUILD_FILES[@]}"; do + curl -s -O "https://git.kernel.org/pub/scm/git/git.git/plain/contrib/diff-highlight/${file}" +done make --quiet # move the created script to ~/.bin, which is in PATH