[PATCH] dim: add a minimum git version check

Jani Nikula jani.nikula at intel.com
Wed Mar 28 13:56:12 UTC 2018


There have been issues with git 2.7 in the past. Require 2.8 or later
for starters.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>

---

I'm not sure what the required version should really be, and how
obnoxious is it to check every time. sort -VC seems to be the neatest
way to do version checks though.
---
 dim | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dim b/dim
index 9fa6d9cd855b..e319a629b13f 100755
--- a/dim
+++ b/dim
@@ -364,6 +364,15 @@ function git_committer_email
 	echo $committer_email
 }
 
+function git_version_check
+{
+	local min_version="git version 2.8"
+
+	if ! echo -e "$min_version\n$(git version)" | sort -VC; then
+		echo "WARNING: recommended minimum $min_version, you have $(git version)"
+	fi
+}
+
 # get message id from file
 # $1 = file
 message_get_id ()
@@ -2210,6 +2219,7 @@ function dim_usage
 
 # occasional check for dim updates
 check_for_updates
+git_version_check
 
 #
 # Command line options.
-- 
2.11.0



More information about the dim-tools mailing list