git-annex/Git/Version.hs
Joey Hess 04a256a0f8
work around git "defense in depth" breakage with git clone checking for hooks
This git bug also broke git-lfs, and I am confident it will be reverted
in the next release.

For now, cloning from an annex:: url wastes some bandwidth on the next
pull by not caching bundles locally.

If git doesn't fix this in the next version, I'd be tempted to rethink
whether bundle objects need to be cached locally. It would be possible to
instead remember which bundles have been seen and their heads, and
respond to the list command with the heads, and avoid unbundling them
agian in fetch. This might even be a useful performance improvement in
the latter case. It would be quite a complication to a currently simple
implementation though.
2024-05-24 15:49:53 -04:00

32 lines
590 B
Haskell

{- git versions
-
- Copyright 2011, 2013 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Git.Version (
installed,
older,
normalize,
GitVersion,
) where
import Utility.Process
import Utility.DottedVersion
type GitVersion = DottedVersion
installed :: IO GitVersion
installed = normalize . extract <$> readProcess "git" ["--version"]
where
extract s = case lines s of
[] -> ""
(l:_) -> unwords $ drop 2 $ words l
older :: String -> IO Bool
older n = do
v <- installed
return $ v < normalize n