summaryrefslogtreecommitdiff
path: root/Git/Repair.hs
diff options
context:
space:
mode:
authorRichard Hartmann <richih@debian.org>2015-12-15 23:26:04 -0700
committerRichard Hartmann <richih@debian.org>2015-12-15 23:26:04 -0700
commitd348ed3d2822a8cd4b777f74641baf040e7839e4 (patch)
tree5d46d93d0b237a213f72e1e7ada60a5fecaf2e75 /Git/Repair.hs
parentad444893f97ed69c4a5f070cb00a6e6cb89bb2cd (diff)
parent3b6310081cde4333494fb1271a7570fc8e5f333a (diff)
downloadgit-repair-d348ed3d2822a8cd4b777f74641baf040e7839e4.tar.gz
Record git-repair (1.20151215-1) in archive suite sid
Diffstat (limited to 'Git/Repair.hs')
-rw-r--r--Git/Repair.hs21
1 files changed, 13 insertions, 8 deletions
diff --git a/Git/Repair.hs b/Git/Repair.hs
index 77a592b..b441f13 100644
--- a/Git/Repair.hs
+++ b/Git/Repair.hs
@@ -1,6 +1,6 @@
{- git repository recovery
-
- - Copyright 2013-2014 Joey Hess <joey@kitenet.net>
+ - Copyright 2013-2014 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -99,7 +99,7 @@ retrieveMissingObjects :: FsckResults -> Maybe FilePath -> Repo -> IO FsckResult
retrieveMissingObjects missing referencerepo r
| not (foundBroken missing) = return missing
| otherwise = withTmpDir "tmprepo" $ \tmpdir -> do
- unlessM (boolSystem "git" [Params "init", File tmpdir]) $
+ unlessM (boolSystem "git" [Param "init", File tmpdir]) $
error $ "failed to create temp repository in " ++ tmpdir
tmpr <- Config.read =<< Construct.fromAbsPath tmpdir
stillmissing <- pullremotes tmpr (remotes r) fetchrefstags missing
@@ -140,7 +140,9 @@ retrieveMissingObjects missing referencerepo r
ps' =
[ Param "fetch"
, Param fetchurl
- , Params "--force --update-head-ok --quiet"
+ , Param "--force"
+ , Param "--update-head-ok"
+ , Param "--quiet"
] ++ ps
fetchr' = fetchr { gitGlobalOpts = gitGlobalOpts fetchr ++ nogc }
nogc = [ Param "-c", Param "gc.auto=0" ]
@@ -225,10 +227,13 @@ badBranches missing r = filterM isbad =<< getAllRefs r
- Relies on packed refs being exploded before it's called.
-}
getAllRefs :: Repo -> IO [Ref]
-getAllRefs r = map toref <$> dirContentsRecursive refdir
- where
- refdir = localGitDir r </> "refs"
- toref = Ref . relPathDirToFile (localGitDir r)
+getAllRefs r = getAllRefs' (localGitDir r </> "refs")
+
+getAllRefs' :: FilePath -> IO [Ref]
+getAllRefs' refdir = do
+ let topsegs = length (splitPath refdir) - 1
+ let toref = Ref . joinPath . drop topsegs . splitPath
+ map toref <$> dirContentsRecursive refdir
explodePackedRefsFile :: Repo -> IO ()
explodePackedRefsFile r = do
@@ -336,7 +341,7 @@ verifyTree :: MissingObjects -> Sha -> Repo -> IO Bool
verifyTree missing treesha r
| S.member treesha missing = return False
| otherwise = do
- (ls, cleanup) <- pipeNullSplit (LsTree.lsTreeParams treesha) r
+ (ls, cleanup) <- pipeNullSplit (LsTree.lsTreeParams treesha []) r
let objshas = map (extractSha . LsTree.sha . LsTree.parseLsTree) ls
if any isNothing objshas || any (`S.member` missing) (catMaybes objshas)
then do