diff options
author | Joey Hess <joey@kitenet.net> | 2014-04-23 14:04:09 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-04-23 14:04:09 -0400 |
commit | e0aff931023a6c3f7a06caaa5dfa1aad2da3889d (patch) | |
tree | f1960ca033d5196da417e7c4d1f0e579bdc21e46 /Git/CatFile.hs | |
parent | 232fce59fabc4243c9b9d7944589986c5cc73f16 (diff) | |
download | git-repair-e0aff931023a6c3f7a06caaa5dfa1aad2da3889d.tar.gz |
merge from git-annex
Diffstat (limited to 'Git/CatFile.hs')
-rw-r--r-- | Git/CatFile.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Git/CatFile.hs b/Git/CatFile.hs index c8cb76d..8e64fc5 100644 --- a/Git/CatFile.hs +++ b/Git/CatFile.hs @@ -11,6 +11,7 @@ module Git.CatFile ( catFileStart', catFileStop, catFile, + catFileDetails, catTree, catObject, catObjectDetails, @@ -52,6 +53,10 @@ catFile :: CatFileHandle -> Branch -> FilePath -> IO L.ByteString catFile h branch file = catObject h $ Ref $ fromRef branch ++ ":" ++ toInternalGitPath file +catFileDetails :: CatFileHandle -> Branch -> FilePath -> IO (Maybe (L.ByteString, Sha, ObjectType)) +catFileDetails h branch file = catObjectDetails h $ Ref $ + fromRef branch ++ ":" ++ toInternalGitPath file + {- Uses a running git cat-file read the content of an object. - Objects that do not exist will have "" returned. -} catObject :: CatFileHandle -> Ref -> IO L.ByteString @@ -103,6 +108,6 @@ catTree h treeref = go <$> catObjectDetails h treeref dropsha = L.drop 21 parsemodefile b = - let (modestr, file) = separate (== ' ') (encodeW8 $ L.unpack b) + let (modestr, file) = separate (== ' ') (decodeBS b) in (file, readmode modestr) readmode = fst . fromMaybe (0, undefined) . headMaybe . readOct |