diff options
author | Michele Locati <michele@locati.it> | 2018-03-13 17:13:26 +0100 |
---|---|---|
committer | Michele Locati <michele@locati.it> | 2018-03-13 17:13:26 +0100 |
commit | ca37a9776ce6511d22e8e695a551b90759b0e4b4 (patch) | |
tree | b2c073b1a0d589fe46b502149021d1760cffe585 | |
parent | 6288a87d903f183bde236173c9c9fbd2b2276492 (diff) | |
download | incremental-git-filter-branch-ca37a9776ce6511d22e8e695a551b90759b0e4b4.tar.gz incremental-git-filter-branch-ca37a9776ce6511d22e8e695a551b90759b0e4b4.tar.bz2 incremental-git-filter-branch-ca37a9776ce6511d22e8e695a551b90759b0e4b4.zip |
Check git version
-rwxr-xr-x | bin/incremental-git-filterbranch.sh | 13 |
1 files changed, 12 insertions, 1 deletions
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 } |