Refuse to build with git older than 1.7.1.1, which is needed for git checkout -B

This commit is contained in:
Joey Hess 2014-01-13 15:17:48 -04:00
parent 0cac4402ac
commit 5a5adc44f5
3 changed files with 22 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import System.FilePath
import System.Environment (getArgs) import System.Environment (getArgs)
import Data.Maybe import Data.Maybe
import Control.Monad.IfElse import Control.Monad.IfElse
import Control.Monad
import Data.Char import Data.Char
import Build.TestConfig import Build.TestConfig
@ -95,8 +96,12 @@ getUpgradeLocation = do
return $ Config "upgradelocation" $ MaybeStringConfig e return $ Config "upgradelocation" $ MaybeStringConfig e
getGitVersion :: Test getGitVersion :: Test
getGitVersion = Config "gitversion" . StringConfig . show getGitVersion = do
<$> Git.Version.installed 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 :: Test
getSshConnectionCaching = Config "sshconnectioncaching" . BoolConfig <$> getSshConnectionCaching = Config "sshconnectioncaching" . BoolConfig <$>

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ git-annex (5.20140108) UNRELEASED; urgency=medium
* Added tahoe special remote. * Added tahoe special remote.
* external special remote protocol: Added GETGITDIR, and GETAVAILABILITY. * external special remote protocol: Added GETGITDIR, and GETAVAILABILITY.
* Android: Avoid passing --clobber to busybox wget. * 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 <joeyh@debian.org> Wed, 08 Jan 2014 13:13:54 -0400 -- Joey Hess <joeyh@debian.org> Wed, 08 Jan 2014 13:13:54 -0400

View file

@ -26,3 +26,16 @@ usage: git checkout [options] <branch>
# End of transcript or log. # 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]]