diff options
author | Joey Hess <joey@kitenet.net> | 2013-11-20 18:31:00 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-11-20 18:31:00 -0400 |
commit | 346bc6528c7999756b652e8e3f0b33f26a48dbbd (patch) | |
tree | dd80cf717afe204f7030bc5fe929c3084a02f228 /Git/Objects.hs | |
parent | 454848b42b2e22a28ba677435318d726ce627e75 (diff) |
merge from git-repair
Diffstat (limited to 'Git/Objects.hs')
-rw-r--r-- | Git/Objects.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Git/Objects.hs b/Git/Objects.hs index b1c580533..d9d2c6701 100644 --- a/Git/Objects.hs +++ b/Git/Objects.hs @@ -9,6 +9,7 @@ module Git.Objects where import Common import Git +import Git.Sha objectsDir :: Repo -> FilePath objectsDir r = localGitDir r </> "objects" @@ -16,12 +17,17 @@ objectsDir r = localGitDir r </> "objects" packDir :: Repo -> FilePath packDir r = objectsDir r </> "pack" +packIdxFile :: FilePath -> FilePath +packIdxFile = flip replaceExtension "idx" + listPackFiles :: Repo -> IO [FilePath] listPackFiles r = filter (".pack" `isSuffixOf`) <$> catchDefaultIO [] (dirContents $ packDir r) -packIdxFile :: FilePath -> FilePath -packIdxFile = flip replaceExtension "idx" +listLooseObjectShas :: Repo -> IO [Sha] +listLooseObjectShas r = catchDefaultIO [] $ + mapMaybe (extractSha . concat . reverse . take 2 . reverse . splitDirectories) + <$> dirContentsRecursiveSkipping (== "pack") (objectsDir r) looseObjectFile :: Repo -> Sha -> FilePath looseObjectFile r sha = objectsDir r </> prefix </> rest |