From 75be1615741bd2eb774b10413aaa81f3c3b6792f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Aug 2025 11:05:41 -0400 Subject: [PATCH] remove git version check for adjusted branch 2686d2d7ea44d9b5d8243da6fc9f2df1d2441a71 made git older than 2.5 not be supported, so this check for an older version is not longer needed. Sponsored-by: Kevin Mueller --- Annex/AdjustedBranch.hs | 14 -------------- Command/Adjust.hs | 3 +-- Test.hs | 17 +++++++---------- Test/Framework.hs | 16 ++++++---------- 4 files changed, 14 insertions(+), 36 deletions(-) diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index e5f7359c95..a9ff9849c0 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -37,8 +37,6 @@ module Annex.AdjustedBranch ( preventCommits, AdjustedClone(..), checkAdjustedClone, - checkVersionSupported, - isGitVersionSupported, ) where import Annex.Common @@ -58,7 +56,6 @@ import Git.Env import Git.Index import Git.FilePath import qualified Git.LockFile -import qualified Git.Version import Annex.CatFile import Annex.Link import Annex.Content.Presence @@ -366,7 +363,6 @@ adjustedBranchRefreshFull' adj origbranch = do adjustToCrippledFileSystem :: Annex () adjustToCrippledFileSystem = do warning "Entering an adjusted branch where files are unlocked as this filesystem does not support locked files." - checkVersionSupported whenM (isNothing <$> inRepo Git.Branch.current) $ commitForAdjustedBranch [] inRepo Git.Branch.current >>= \case @@ -673,13 +669,3 @@ checkAdjustedClone = ifM isBareRepo setBasisBranch basis p _ -> giveup $ "Unable to clean up from clone of adjusted branch; perhaps you should check out " ++ Git.Ref.describe origbranch return InAdjustedClone - -checkVersionSupported :: Annex () -checkVersionSupported = - unlessM (liftIO isGitVersionSupported) $ - giveup "Your version of git is too old; upgrade it to 2.2.0 or newer to use adjusted branches." - --- git 2.2.0 needed for GIT_COMMON_DIR which is needed --- by updateAdjustedBranch to use withWorkTreeRelated. -isGitVersionSupported :: IO Bool -isGitVersionSupported = not <$> Git.Version.older "2.2.0" diff --git a/Command/Adjust.hs b/Command/Adjust.hs index 1d3bf8ea62..4d143eeb9a 100644 --- a/Command/Adjust.hs +++ b/Command/Adjust.hs @@ -69,7 +69,6 @@ seek :: Adjustment -> CommandSeek seek = commandAction . start start :: Adjustment -> CommandStart -start adj = do - checkVersionSupported +start adj = starting "adjust" (ActionItemOther Nothing) (SeekInput []) $ next $ enterAdjustedBranch adj diff --git a/Test.hs b/Test.hs index cb3a29de13..7376b61348 100644 --- a/Test.hs +++ b/Test.hs @@ -98,7 +98,7 @@ import qualified Utility.Gpg optParser :: Parser TestOptions optParser = TestOptions - <$> snd (tastyParser (tests 1 False True (TestOptions mempty False False Nothing mempty False mempty))) + <$> snd (tastyParser (tests 1 False (TestOptions mempty False False Nothing mempty False mempty))) <*> switch ( long "keep-failures" <> help "preserve repositories on test failure" @@ -133,14 +133,14 @@ optParser = TestOptions runner :: TestOptions -> IO () runner opts = parallelTestRunner opts tests -tests :: Int -> Bool -> Bool -> TestOptions -> [TestTree] -tests numparts crippledfilesystem adjustedbranchok opts = +tests :: Int -> Bool -> TestOptions -> [TestTree] +tests numparts crippledfilesystem opts = properties : withTestMode remotetestmode testRemotes : concatMap mkrepotests testmodes where testmodes = catMaybes - [ canadjust ("v10 adjusted unlocked branch", (testMode opts (RepoVersion 10)) { adjustedUnlockedBranch = True }) + [ Just ("v10 adjusted unlocked branch", (testMode opts (RepoVersion 10)) { adjustedUnlockedBranch = True }) , unlesscrippled ("v10 unlocked", (testMode opts (RepoVersion 10)) { unlockedFiles = True }) , unlesscrippled ("v10 locked", testMode opts (RepoVersion 10)) ] @@ -148,9 +148,6 @@ tests numparts crippledfilesystem adjustedbranchok opts = unlesscrippled v | crippledfilesystem = Nothing | otherwise = Just v - canadjust v - | adjustedbranchok = Just v - | otherwise = Nothing mkrepotests (d, te) = map (\uts -> withTestMode te uts) (repoTests d numparts) @@ -1370,7 +1367,7 @@ test_conflict_resolution = test_conflict_resolution_adjusted_branch :: Assertion test_conflict_resolution_adjusted_branch = withtmpclonerepo $ \r1 -> - withtmpclonerepo $ \r2 -> whenM (adjustedbranchsupported r2) $ do + withtmpclonerepo $ \r2 -> do intopdir r1 $ do disconnectOrigin writecontent conflictor "conflictor1" @@ -1687,7 +1684,7 @@ test_mixed_lock_conflict_resolution = test_adjusted_branch_merge_regression :: Assertion test_adjusted_branch_merge_regression = do withtmpclonerepo $ \r1 -> - withtmpclonerepo $ \r2 -> whenM (adjustedbranchsupported r1) $ do + withtmpclonerepo $ \r2 -> do pair r1 r2 setup r1 setup r2 @@ -1715,7 +1712,7 @@ test_adjusted_branch_merge_regression = do - a subtree to an existing tree lost files. -} test_adjusted_branch_subtree_regression :: Assertion test_adjusted_branch_subtree_regression = - withtmpclonerepo $ \r -> whenM (adjustedbranchsupported r) $ do + withtmpclonerepo $ \r -> do intopdir r $ do disconnectOrigin origbranch <- annexeval origBranch diff --git a/Test/Framework.hs b/Test/Framework.hs index 7ebf3f3f25..a0dd710522 100644 --- a/Test/Framework.hs +++ b/Test/Framework.hs @@ -229,9 +229,6 @@ inpath path a = do Right v -> return v Left e -> throwM e -adjustedbranchsupported :: FilePath -> IO Bool -adjustedbranchsupported repo = intopdir repo $ Annex.AdjustedBranch.isGitVersionSupported - setuprepo :: FilePath -> IO FilePath setuprepo dir = do cleanup dir @@ -746,7 +743,7 @@ runFakeSsh ps = error $ "fake ssh option parse error: " ++ show ps - leave open are closed before finalCleanup is run at the end. This - prevents some failures to clean up after the test suite. -} -parallelTestRunner :: TestOptions -> (Int -> Bool -> Bool -> TestOptions -> [TestTree]) -> IO () +parallelTestRunner :: TestOptions -> (Int -> Bool -> TestOptions -> [TestTree]) -> IO () parallelTestRunner opts mkts = do numjobs <- case concurrentJobs opts of Just NonConcurrent -> pure 1 @@ -755,7 +752,7 @@ parallelTestRunner opts mkts = do Nothing -> getNumProcessors parallelTestRunner' numjobs opts mkts -parallelTestRunner' :: Int -> TestOptions -> (Int -> Bool -> Bool -> TestOptions -> [TestTree]) -> IO () +parallelTestRunner' :: Int -> TestOptions -> (Int -> Bool -> TestOptions -> [TestTree]) -> IO () parallelTestRunner' numjobs opts mkts | fakeSsh opts = runFakeSsh (internalData opts) | otherwise = go =<< Utility.Env.getEnv subenv @@ -810,8 +807,7 @@ parallelTestRunner' numjobs opts mkts <$> Annex.Init.probeCrippledFileSystem' (toOsPath tmpdir) Nothing Nothing False - adjustedbranchok <- Annex.AdjustedBranch.isGitVersionSupported - let ts = mkts numparts crippledfilesystem adjustedbranchok opts + let ts = mkts numparts crippledfilesystem opts let warnings = fst (tastyParser ts) unless (null warnings) $ do hPutStrLn stderr "warnings from tasty:" @@ -827,7 +823,7 @@ parallelTestRunner' numjobs opts mkts let subdir = fromOsPath $ toOsPath tmpdir toOsPath (show n) ensuredir subdir let p = (proc pp ps) - { env = Just ((subenv, show (n, crippledfilesystem, adjustedbranchok)):environ) + { env = Just ((subenv, show (n, crippledfilesystem)):environ) , cwd = Just subdir } (_, _, _, pid) <- createProcessConcurrent p @@ -839,8 +835,8 @@ parallelTestRunner' numjobs opts mkts return (length ts, exitcodes) go (Just subenvval) = case readish subenvval of Nothing -> error ("Bad " ++ subenv) - Just (n, crippledfilesystem, adjustedbranchok) -> setTestEnv $ do - let ts = mkts numparts crippledfilesystem adjustedbranchok opts + Just (n, crippledfilesystem) -> setTestEnv $ do + let ts = mkts numparts crippledfilesystem opts let t = topLevelTestGroup [ ts !! (n - 1) ] case tryIngredients ingredients tastyopts t of Nothing -> error "No tests found!?" -- 2.30.2