repair: Support old git versions from before git fsck --no-dangling was implemented.

This commit is contained in:
Joey Hess 2014-01-13 18:10:45 -04:00
parent 9c34c0408a
commit 5e6e89f423
2 changed files with 17 additions and 5 deletions

View file

@ -20,6 +20,7 @@ import Git
import Git.Command import Git.Command
import Git.Sha import Git.Sha
import Utility.Batch import Utility.Batch
import qualified Git.BuildVersion
import qualified Data.Set as S import qualified Data.Set as S
@ -75,11 +76,20 @@ isMissing s r = either (const True) (const False) <$> tryIO dump
] r ] r
findShas :: String -> [Sha] findShas :: String -> [Sha]
findShas = catMaybes . map extractSha . concat . map words . lines findShas = catMaybes . map extractSha . concat . map words . filter wanted . lines
where
wanted l
| supportsNoDangling = True
| otherwise = not ("dangling " `isPrefixOf` l)
fsckParams :: Repo -> [CommandParam] fsckParams :: Repo -> [CommandParam]
fsckParams = gitCommandLine $ fsckParams = gitCommandLine $ map Param $ catMaybes
[ Param "fsck" [ Just "fsck"
, Param "--no-dangling" , if supportsNoDangling
, Param "--no-reflogs" then Just "--no-dangling"
else Nothing
, Just "--no-reflogs"
] ]
supportsNoDangling :: Bool
supportsNoDangling = not $ Git.BuildVersion.older "1.7.10"

2
debian/changelog vendored
View file

@ -6,6 +6,8 @@ git-annex (5.20140108) UNRELEASED; urgency=medium
* Refuse to build with git older than 1.7.1.1, which is needed for * Refuse to build with git older than 1.7.1.1, which is needed for
git checkout -B git checkout -B
* map: Fix display of v5 direct mode repos. * map: Fix display of v5 direct mode repos.
* repair: Support old git versions from before git fsck --no-dangling was
implemented.
-- 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