Git protocol implementation in pure Haskell
Clone
HTTPS:
darcs clone https://vervis.peers.community/repos/rL9jo
SSH:
darcs clone USERNAME@vervis.peers.community:rL9jo
Tags
TODO
Types.hs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | {- This file is part of hit-network.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
-
- ♡ Copying is an act of love. Please copy, reuse and share.
-
- The author(s) have dedicated all copyright and related and neighboring
- rights to this software to the public domain worldwide. This software is
- distributed without any warranty.
-
- You should have received a copy of the CC0 Public Domain Dedication along
- with this software. If not, see
- <http://creativecommons.org/publicdomain/zero/1.0/>.
-}
module Network.Git.Types
( -- * Mode helper types
SideBandMode (..)
, AckMode (..)
-- * Capability lists
, SharedCapability (..)
, FetchCapability (..)
, PushCapability (..)
-- * Capability mode
, SharedCapabilityMode (..)
, PushCapabilityMode (..)
, FetchCapabilityMode (..)
-- * Other
, Service (..)
)
where
import Data.ByteString (ByteString)
-- I want to explain how the capability based types are supposed to work.
-- Basically what we have here is:
--
-- * A record to fill and use during communication
-- * Sum types which specify capability declarations
--
-- The idea is that we run like this:
--
-- (1) Start with the default record and a record expressing what is supported
-- (2) Send the differences
-- (3) Receive and parse a list of values of the sum type
-- (4) Go over the list and update the record
-- (5) Finally we have a record to use for the rest of the protocol
--
-- Since right now we're just on fetch and the capability list is hardcoded in
-- 'buildRefDiscover', the changes will be:
--
-- (1) Have 2 fields for caps, one for shared and one for fetch-specific
-- (2) Have functions for Putting caps
-- (3) Have the 2 fields hardcoded to 2 empty lists for now
data SideBandMode = NoSideBand | SideBand | SideBand64k
data AckMode = SingleAck | MultiAck | MultiAckDetailed
data SharedCapability
= CapOfsDelta
| CapSideBand64k
| CapAgent ByteString
data FetchCapability
= CapMultiAck
| CapMultiAckDetailed
| CapNoDone
| CapThinPack Bool
| CapSideBand
| CapShallow
| CapNoProgress
| CapIncludeTag
| CapAllowTipSHA1InWant
| CapAllowReachableSha1InWant
data PushCapability
= CapAtomic
| CapReportStatus
| CapDeleteRefs
| CapQuiet
| CapPushCert ByteString
data SharedCapabilityMode = SharedCapabilityMode
{ scOfsDelta :: Bool
, scSideBand :: SideBandMode
, scAgent :: ByteString
}
data FetchCapabilityMode = FetchCapabilityMode
{ fcMultiAck :: AckMode
, fcNoDone :: Bool
, fcThinPack :: Bool
, fcShallow :: Bool
, fcNoProgress :: Bool
, fcIncludeTag :: Bool
, fcAllowTipShaInWant :: Bool
, fcAllowReachableShaInWant :: Bool
}
data PushCapabilityMode = PushCapabilityMode
{ pcAtomic :: Bool
, pcReportStatus :: Bool
, pcDeleteRefs :: Bool
, pcQuiet :: Bool
, pcPushCert :: Maybe ByteString
}
data Service = UploadPack
|