From 9d5e8dbc63ccbda4e2339a79c4c3938bb16d25f3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 13 Jan 2014 15:17:48 -0400 Subject: Refuse to build with git older than 1.7.1.1, which is needed for git checkout -B --- Build/Configure.hs | 9 +++++++-- debian/changelog | 2 ++ doc/bugs/Check_for_minimum_Git_version.mdwn | 13 +++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Build/Configure.hs b/Build/Configure.hs index da66aacf2..487ed9b10 100644 --- a/Build/Configure.hs +++ b/Build/Configure.hs @@ -10,6 +10,7 @@ import System.FilePath import System.Environment (getArgs) import Data.Maybe import Control.Monad.IfElse +import Control.Monad import Data.Char import Build.TestConfig @@ -95,8 +96,12 @@ getUpgradeLocation = do return $ Config "upgradelocation" $ MaybeStringConfig e getGitVersion :: Test -getGitVersion = Config "gitversion" . StringConfig . show - <$> Git.Version.installed +getGitVersion = do + v <- Git.Version.installed + let oldestallowed = Git.Version.normalize "1.7.1.0" + when (v < oldestallowed) $ + error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)" + return $ Config "gitversion" $ StringConfig $ show v getSshConnectionCaching :: Test getSshConnectionCaching = Config "sshconnectioncaching" . BoolConfig <$> diff --git a/debian/changelog b/debian/changelog index c9edeef4c..9e7a06db8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ git-annex (5.20140108) UNRELEASED; urgency=medium * Added tahoe special remote. * external special remote protocol: Added GETGITDIR, and GETAVAILABILITY. * Android: Avoid passing --clobber to busybox wget. + * Refuse to build with git older than 1.7.1.1, which is needed for + git checkout -B -- Joey Hess Wed, 08 Jan 2014 13:13:54 -0400 diff --git a/doc/bugs/Check_for_minimum_Git_version.mdwn b/doc/bugs/Check_for_minimum_Git_version.mdwn index 3f072fed5..f7eabb2b8 100644 --- a/doc/bugs/Check_for_minimum_Git_version.mdwn +++ b/doc/bugs/Check_for_minimum_Git_version.mdwn @@ -26,3 +26,16 @@ usage: git checkout [options] # End of transcript or log. """]] + +> git-annex checks the git version at compile time and arranges to use +> commands that will work with that version of git at run time. +> +> Adding a runtime check for a minimum git version would slow every git-annex +> command down and so I don't want to do it. It's up to the user to not +> built git-annex with a new version of git and then try to use it with an +> old version of git. +> +> `git checkout -B` seems to have been added to git quite a long time ago +> (2010), in version 1.7.1.1. I've made git-annex check at compile +> time if being built with such an old version and refuse to build. +> [[done]]. --[[Joey]] -- cgit v1.2.3