git
InternalsVaibhav Sagar
git
repositoriesdata GitObjectGeneric ref container entries
= Blob {blobContent :: B.ByteString}
| Tree {treeEntries :: container entries}
| Commit
{ commitTreeRef :: ref
, commitParentRefs :: [ref]
, commitAuthor :: PersonTime
, commitCommitter :: PersonTime
, commitSignature :: Maybe B.ByteString
, commitMessage :: B.ByteString
}
| Tag
{ tagObjectRef :: ref
, tagObjectType :: B.ByteString
, tagName :: B.ByteString
, tagTagger :: PersonTime
, tagAnnotation :: B.ByteString
}
deriving (Eq)
type GitObject = GitObjectGeneric Ref Set TreeEntry
data TreeEntry = TreeEntry
{ entryPerms :: EntryPermission
, entryName :: B.ByteString
, entryRef :: Ref
}
data PersonTime = PersonTime
{ personName :: B.ByteString
, personMail :: B.ByteString
, personTime :: B.ByteString
, personTZ :: B.ByteString
}
deriving (Eq)
data EntryPermission
= Directory
| Regular
| Executable
| SymbolicLink
| SubModule
deriving (Show, Eq)
type Ref = B.ByteString
type Repo = FilePath
getNextEntry = do
Just (Right tLen) <- PA.parse parseTypeLen
baseRef <- case fst tLen of
OfsDeltaObject -> do
Just (Right offset) <- PA.parse parseOffset
return $ encodeOffset offset
RefDeltaObject -> do
Just (Right ref) <- PA.parse parseBinRef
return $ fst $ decode ref
_ -> return ""
remainder <- get
let decompressed = PZ.decompress' PZ.defaultWindowBits remainder
PB.drawByte
Just levelByte <- PB.peekByte
let level = getCompressionLevel levelByte
return (uncurry encodeTypeLen tLen, baseRef, decompressed, level)
src
├── Duffer
│ ├── Loose
│ │ ├── Objects.hs
│ │ └── Parser.hs
│ ├── Loose.hs
│ ├── Misc.hs
│ ├── Pack
│ │ ├── Entries.hs
│ │ ├── File.hs
│ │ └── Parser.hs
│ ├── Pack.hs
│ ├── Plumbing.hs
│ ├── Unified.hs
│ ├── WithRepo.hs
│ └── WorkObject.hs
└── Duffer.hs
duffer
uses its own repo to test itself.gh-pages
branch or http://www.vaibhavsagar.com/dufferhttps://www.recurse.com