From ca37a9776ce6511d22e8e695a551b90759b0e4b4 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 13 Mar 2018 17:13:26 +0100 Subject: Check git version --- bin/incremental-git-filterbranch.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/incremental-git-filterbranch.sh b/bin/incremental-git-filterbranch.sh index 6bb965f..1105e07 100755 --- a/bin/incremental-git-filterbranch.sh +++ b/bin/incremental-git-filterbranch.sh @@ -250,12 +250,23 @@ checkEnvironment () { fi if ! command -v cut >/dev/null then - die 'The required grep command is not available.' + die 'The required cut command is not available.' + fi + if ! command -v sort >/dev/null + then + die 'The required sort command is not available.' fi if ! command -v md5sum >/dev/null then die 'The required md5sum command is not available.' fi + checkEnvironment_vMin='2.15.0' + checkEnvironment_vCur=$(git --version | cut -d ' ' -f3) + checkEnvironment_vWork=$(printf "${checkEnvironment_vCur}\n${checkEnvironment_vMin}" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1) + if test "${checkEnvironment_vWork}" != "${checkEnvironment_vMin}" + then + die "This script requires git ${checkEnvironment_vMin} (you have git ${checkEnvironment_vWork})." + fi } -- cgit v1.2.3