Removed support for git versions older than 2.5.
This entirely removes Git.BuildVersion, which avoids the possibility that git-annex will behave differently based on the version of git it was built with, rather than the version it's used with. Debian oldoldstable is the oldest version of git that git-annex needs to support, since it's used in the amd64ancient build. cabal configure will fail if the git version is too old. Sponsored-by: Nicholas Golder-Manning
This commit is contained in:
parent
afff2bb47d
commit
2686d2d7ea
6 changed files with 7 additions and 42 deletions
|
@ -81,7 +81,7 @@ getGitVersion = go =<< getEnv "FORCE_GIT_VERSION"
|
||||||
go (Just s) = return $ Config "gitversion" $ StringConfig s
|
go (Just s) = return $ Config "gitversion" $ StringConfig s
|
||||||
go Nothing = do
|
go Nothing = do
|
||||||
v <- Git.Version.installed
|
v <- Git.Version.installed
|
||||||
let oldestallowed = Git.Version.normalize "2.1"
|
let oldestallowed = Git.Version.normalize "2.5"
|
||||||
when (v < oldestallowed) $
|
when (v < oldestallowed) $
|
||||||
error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
|
error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
|
||||||
return $ Config "gitversion" $ StringConfig $ show v
|
return $ Config "gitversion" $ StringConfig $ show v
|
||||||
|
|
|
@ -26,6 +26,7 @@ git-annex (10.20250722) UNRELEASED; urgency=medium
|
||||||
for exporttree=yes/importtree=yes remotes.
|
for exporttree=yes/importtree=yes remotes.
|
||||||
* Bump aws build dependency to 0.24.1.
|
* Bump aws build dependency to 0.24.1.
|
||||||
* stack.yaml: Update to lts-24.2.
|
* stack.yaml: Update to lts-24.2.
|
||||||
|
* Removed support for git versions older than 2.5.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 30 Jul 2025 13:45:42 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 30 Jul 2025 13:45:42 -0400
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import Annex.WorkTree
|
||||||
import Logs.Smudge
|
import Logs.Smudge
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import qualified Database.Keys
|
import qualified Database.Keys
|
||||||
import qualified Git.BuildVersion
|
|
||||||
import Git.FilePath
|
import Git.FilePath
|
||||||
import Git.Types
|
import Git.Types
|
||||||
import Git.HashObject
|
import Git.HashObject
|
||||||
|
@ -97,15 +96,7 @@ clean file = do
|
||||||
Annex.BranchState.disableUpdate -- optimisation
|
Annex.BranchState.disableUpdate -- optimisation
|
||||||
b <- liftIO $ L.hGetContents stdin
|
b <- liftIO $ L.hGetContents stdin
|
||||||
let passthrough = liftIO $ L.hPut stdout b
|
let passthrough = liftIO $ L.hPut stdout b
|
||||||
-- Before git 2.5, failing to consume all stdin here would
|
let discardreststdin = liftIO $ hClose stdin
|
||||||
-- cause a SIGPIPE and crash it.
|
|
||||||
-- Newer git catches the signal and stops sending, which is
|
|
||||||
-- much faster. (Also, git seems to forget to free memory
|
|
||||||
-- when sending the file, so the less we let it send, the
|
|
||||||
-- less memory it will waste.)
|
|
||||||
let discardreststdin = if Git.BuildVersion.older "2.5"
|
|
||||||
then L.length b `seq` return ()
|
|
||||||
else liftIO $ hClose stdin
|
|
||||||
let emitpointer = liftIO . S.hPut stdout . formatPointer
|
let emitpointer = liftIO . S.hPut stdout . formatPointer
|
||||||
clean' file (parseLinkTargetOrPointerLazy' b)
|
clean' file (parseLinkTargetOrPointerLazy' b)
|
||||||
passthrough
|
passthrough
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
{- git build version
|
|
||||||
-
|
|
||||||
- Copyright 2011 Joey Hess <id@joeyh.name>
|
|
||||||
-
|
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
|
||||||
-}
|
|
||||||
|
|
||||||
module Git.BuildVersion where
|
|
||||||
|
|
||||||
import Git.Version
|
|
||||||
import qualified BuildInfo
|
|
||||||
|
|
||||||
{- Using the version it was configured for avoids running git to check its
|
|
||||||
- version, at the cost that upgrading git won't be noticed.
|
|
||||||
- This is only acceptable because it's rare that git's version influences
|
|
||||||
- code's behavior. -}
|
|
||||||
buildVersion :: GitVersion
|
|
||||||
buildVersion = normalize BuildInfo.gitversion
|
|
||||||
|
|
||||||
older :: String -> Bool
|
|
||||||
older n = buildVersion < normalize n
|
|
|
@ -54,7 +54,6 @@ import Git.Types
|
||||||
import Git.HashObject
|
import Git.HashObject
|
||||||
import qualified Git.LsTree as LsTree
|
import qualified Git.LsTree as LsTree
|
||||||
import qualified Utility.CoProcess as CoProcess
|
import qualified Utility.CoProcess as CoProcess
|
||||||
import qualified Git.BuildVersion as BuildVersion
|
|
||||||
import Utility.Tuple
|
import Utility.Tuple
|
||||||
|
|
||||||
data CatFileHandle = CatFileHandle
|
data CatFileHandle = CatFileHandle
|
||||||
|
@ -403,14 +402,10 @@ withCatFileStream
|
||||||
withCatFileStream check repo reader = assertLocal repo $
|
withCatFileStream check repo reader = assertLocal repo $
|
||||||
bracketIO start stop $ \(c, hin, hout, _) -> reader c hin hout
|
bracketIO start stop $ \(c, hin, hout, _) -> reader c hin hout
|
||||||
where
|
where
|
||||||
params = catMaybes
|
params =
|
||||||
[ Just $ Param "cat-file"
|
[ Param "cat-file"
|
||||||
, Just $ Param ("--batch" ++ (if check then "-check" else "") ++ "=" ++ batchFormat)
|
, Param ("--batch" ++ (if check then "-check" else "") ++ "=" ++ batchFormat)
|
||||||
-- This option makes it faster, but is not present in
|
, Param "--buffer" -- makes it faster
|
||||||
-- older versions of git.
|
|
||||||
, if BuildVersion.older "2.4.3"
|
|
||||||
then Nothing
|
|
||||||
else Just $ Param "--buffer"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
start = do
|
start = do
|
||||||
|
|
|
@ -813,7 +813,6 @@ Executable git-annex
|
||||||
Git
|
Git
|
||||||
Git.AutoCorrect
|
Git.AutoCorrect
|
||||||
Git.Branch
|
Git.Branch
|
||||||
Git.BuildVersion
|
|
||||||
Git.Bundle
|
Git.Bundle
|
||||||
Git.CatFile
|
Git.CatFile
|
||||||
Git.CheckAttr
|
Git.CheckAttr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue