summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-13 18:10:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-13 18:10:45 -0400
commit3f4ed03cf0c68ffeaa6be113ab45679ff3e8d712 (patch)
treee7caefd21581472629f6a6ac94d23f763319906d
parent02a384b9c38ffef713400a1018fb1037bccfded8 (diff)
repair: Support old git versions from before git fsck --no-dangling was implemented.
-rw-r--r--Git/Fsck.hs20
-rw-r--r--debian/changelog2
2 files changed, 17 insertions, 5 deletions
diff --git a/Git/Fsck.hs b/Git/Fsck.hs
index 5389d46ef..a49978d44 100644
--- a/Git/Fsck.hs
+++ b/Git/Fsck.hs
@@ -20,6 +20,7 @@ import Git
import Git.Command
import Git.Sha
import Utility.Batch
+import qualified Git.BuildVersion
import qualified Data.Set as S
@@ -75,11 +76,20 @@ isMissing s r = either (const True) (const False) <$> tryIO dump
] r
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 = gitCommandLine $
- [ Param "fsck"
- , Param "--no-dangling"
- , Param "--no-reflogs"
+fsckParams = gitCommandLine $ map Param $ catMaybes
+ [ Just "fsck"
+ , if supportsNoDangling
+ then Just "--no-dangling"
+ else Nothing
+ , Just "--no-reflogs"
]
+
+supportsNoDangling :: Bool
+supportsNoDangling = not $ Git.BuildVersion.older "1.7.10"
diff --git a/debian/changelog b/debian/changelog
index 7ccb29ee8..e844c5020 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
git checkout -B
* 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