From 117b520825669f0bfc8db7d3ddf80ae6768b8185 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Aug 2025 11:20:20 -0400 Subject: [PATCH] Removed support for git versions older than 2.22. Which fixed an OOM with unlocked files. Debian oldoldstable is the oldest version of git that git-annex needs to support, since it's used in the amd64ancient build. That has 2.30. At this point, the only complication git-annex for an bug in old versions of git is that git bundle was broken before git 2.31. That prevents git-remote-annex from working with git 2.30. Sponsored-by: Luke T. Shumaker --- Build/Configure.hs | 2 +- CHANGELOG | 2 +- Git/Merge.hs | 15 ++++----------- Upgrade/V5.hs | 31 +------------------------------ 4 files changed, 7 insertions(+), 43 deletions(-) diff --git a/Build/Configure.hs b/Build/Configure.hs index c8bebaaba6..dc5e634016 100644 --- a/Build/Configure.hs +++ b/Build/Configure.hs @@ -81,7 +81,7 @@ getGitVersion = go =<< getEnv "FORCE_GIT_VERSION" go (Just s) = return $ Config "gitversion" $ StringConfig s go Nothing = do v <- Git.Version.installed - let oldestallowed = Git.Version.normalize "2.5" + let oldestallowed = Git.Version.normalize "2.22" when (v < oldestallowed) $ error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)" return $ Config "gitversion" $ StringConfig $ show v diff --git a/CHANGELOG b/CHANGELOG index 7717641e64..8f71921a56 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,7 +26,7 @@ git-annex (10.20250722) UNRELEASED; urgency=medium for exporttree=yes/importtree=yes remotes. * Bump aws build dependency to 0.24.1. * stack.yaml: Update to lts-24.2. - * Removed support for git versions older than 2.5. + * Removed support for git versions older than 2.22. -- Joey Hess Wed, 30 Jul 2025 13:45:42 -0400 diff --git a/Git/Merge.hs b/Git/Merge.hs index b88d9a00f5..db9c3ef4e3 100644 --- a/Git/Merge.hs +++ b/Git/Merge.hs @@ -17,7 +17,6 @@ module Git.Merge ( import Common import Git import Git.Command -import qualified Git.Version import Git.Branch (CommitMode(..)) data MergeConfig @@ -50,20 +49,14 @@ merge' extraparams branch mergeconfig commitmode r merge'' :: [CommandParam] -> [MergeConfig] -> Repo -> IO Bool merge'' ps mergeconfig r - | MergeUnrelatedHistories `elem` mergeconfig = do - up <- mergeUnrelatedHistoriesParam - go (ps ++ maybeToList up) + | MergeUnrelatedHistories `elem` mergeconfig = + go (ps ++ [mergeUnrelatedHistoriesParam]) | otherwise = go ps where go ps' = runBool ps' r -{- Git used to default to merging unrelated histories; newer versions need - - an option. -} -mergeUnrelatedHistoriesParam :: IO (Maybe CommandParam) -mergeUnrelatedHistoriesParam = ifM (Git.Version.older "2.9.0") - ( return Nothing - , return (Just (Param "--allow-unrelated-histories")) - ) +mergeUnrelatedHistoriesParam :: CommandParam +mergeUnrelatedHistoriesParam = Param "--allow-unrelated-histories" {- Stage the merge into the index, but do not commit it.-} stageMerge :: Ref -> [MergeConfig] -> Repo -> IO Bool diff --git a/Upgrade/V5.hs b/Upgrade/V5.hs index ee90ba7cd8..887b591860 100644 --- a/Upgrade/V5.hs +++ b/Upgrade/V5.hs @@ -25,13 +25,11 @@ import qualified Database.Keys import qualified Git import qualified Git.LsFiles import qualified Git.Branch -import qualified Git.Version import Git.FilePath import Git.FileMode import Git.Config import Git.Ref import Utility.InodeCache -import Utility.DottedVersion import Annex.AdjustedBranch import qualified Utility.FileIO as F @@ -39,13 +37,7 @@ upgrade :: Bool -> Annex UpgradeResult upgrade automatic = flip catchNonAsync onexception $ do unless automatic $ showAction "v5 to v6" - ifM isDirect - ( do - checkGitVersionForDirectUpgrade - convertDirect - , do - checkGitVersionForIndirectUpgrade - ) + whenM isDirect convertDirect scanAnnexedFiles configureSmudgeFilter -- Inode sentinal file was only used in direct mode and when @@ -60,27 +52,6 @@ upgrade automatic = flip catchNonAsync onexception $ do warning $ UnquotedString $ "caught exception: " ++ show e return UpgradeFailed --- git before 2.22 would OOM running git status on a large file. --- --- Older versions of git that are patched (with --- commit 02156ab031e430bc45ce6984dfc712de9962dec8) --- can include "oomfix" in their version to indicate it. -gitWillOOM :: Annex Bool -gitWillOOM = liftIO $ do - v <- Git.Version.installed - return $ v < Git.Version.normalize "2.22" && - not ("oomfix" `isInfixOf` fromDottedVersion v) - --- configureSmudgeFilter has to run git status, and direct mode files --- are unlocked, so avoid the upgrade failing half way through. -checkGitVersionForDirectUpgrade :: Annex () -checkGitVersionForDirectUpgrade = whenM gitWillOOM $ - giveup "You must upgrade git to version 2.22 or newer in order to use this version of git-annex in this repository." - -checkGitVersionForIndirectUpgrade :: Annex () -checkGitVersionForIndirectUpgrade = whenM gitWillOOM $ - warning "Git is older than version 2.22 and so it has a memory leak that affects using unlocked files. Recommend you upgrade git before unlocking any files in your repository." - convertDirect :: Annex () convertDirect = do {- Direct mode makes the same tradeoff of using less disk -- 2.30.2