mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Completely remove blobKind
This commit is contained in:
parent
8ce213fc44
commit
ad377910f9
@ -3,7 +3,6 @@ module Data.Blob
|
|||||||
, BlobKind(..)
|
, BlobKind(..)
|
||||||
, These(..)
|
, These(..)
|
||||||
, modeToDigits
|
, modeToDigits
|
||||||
, defaultPlainBlob
|
|
||||||
, nullBlob
|
, nullBlob
|
||||||
, sourceBlob
|
, sourceBlob
|
||||||
, nullOid
|
, nullOid
|
||||||
@ -59,7 +58,6 @@ data Blob = Blob
|
|||||||
{ blobSource :: Source -- ^ The UTF-8 encoded source text of the blob.
|
{ blobSource :: Source -- ^ The UTF-8 encoded source text of the blob.
|
||||||
, blobOid :: ByteString -- ^ The Git object ID (SHA-1) of the blob.
|
, blobOid :: ByteString -- ^ The Git object ID (SHA-1) of the blob.
|
||||||
, blobPath :: FilePath -- ^ The file path to the blob.
|
, blobPath :: FilePath -- ^ The file path to the blob.
|
||||||
, blobKind :: BlobKind -- ^ The kind of blob.
|
|
||||||
, blobLanguage :: Maybe Language -- ^ The language of this blob. Nothing denotes a langauge we don't support yet.
|
, blobLanguage :: Maybe Language -- ^ The language of this blob. Nothing denotes a langauge we don't support yet.
|
||||||
}
|
}
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
@ -73,15 +71,11 @@ modeToDigits (PlainBlob mode) = pack $ showOct mode ""
|
|||||||
modeToDigits (ExecutableBlob mode) = pack $ showOct mode ""
|
modeToDigits (ExecutableBlob mode) = pack $ showOct mode ""
|
||||||
modeToDigits (SymlinkBlob mode) = pack $ showOct mode ""
|
modeToDigits (SymlinkBlob mode) = pack $ showOct mode ""
|
||||||
|
|
||||||
-- | The default plain blob mode
|
|
||||||
defaultPlainBlob :: BlobKind
|
|
||||||
defaultPlainBlob = PlainBlob 0o100644
|
|
||||||
|
|
||||||
nullBlob :: Blob -> Bool
|
nullBlob :: Blob -> Bool
|
||||||
nullBlob Blob{..} = blobOid == nullOid || nullSource blobSource
|
nullBlob Blob{..} = blobOid == nullOid || nullSource blobSource
|
||||||
|
|
||||||
sourceBlob :: FilePath -> Maybe Language -> Source -> Blob
|
sourceBlob :: FilePath -> Maybe Language -> Source -> Blob
|
||||||
sourceBlob filepath language source = Blob source nullOid filepath defaultPlainBlob language
|
sourceBlob filepath language source = Blob source nullOid filepath language
|
||||||
|
|
||||||
nullOid :: ByteString
|
nullOid :: ByteString
|
||||||
nullOid = "0000000000000000000000000000000000000000"
|
nullOid = "0000000000000000000000000000000000000000"
|
||||||
|
@ -253,4 +253,4 @@ blankDiff = merge (arrayInfo, arrayInfo) (Indexed [ inserting (Term $ literalInf
|
|||||||
literalInfo = Nothing :. Range 1 2 :. StringLiteral :. sourceSpanBetween (1, 2) (1, 4) :. Nil
|
literalInfo = Nothing :. Range 1 2 :. StringLiteral :. sourceSpanBetween (1, 2) (1, 4) :. Nil
|
||||||
|
|
||||||
blankDiffBlobs :: Both Blob
|
blankDiffBlobs :: Both Blob
|
||||||
blankDiffBlobs = both (Blob (fromText "[]") nullOid "a.js" defaultPlainBlob (Just TypeScript)) (Blob (fromText "[a]") nullOid "b.js" defaultPlainBlob (Just TypeScript))
|
blankDiffBlobs = both (Blob (fromText "[]") nullOid "a.js" (Just TypeScript)) (Blob (fromText "[a]") nullOid "b.js" (Just TypeScript))
|
||||||
|
@ -37,4 +37,4 @@ spec = parallel $ do
|
|||||||
result `shouldBe` (Diff (Patch (Delete (In () []))) :: Diff [] () ())
|
result `shouldBe` (Diff (Patch (Delete (In () []))) :: Diff [] () ())
|
||||||
|
|
||||||
where
|
where
|
||||||
methodsBlob = Blob "def foo\nend\n" "ff7bbbe9495f61d9e1e58c597502d152bab1761e" "methods.rb" defaultPlainBlob (Just Ruby)
|
methodsBlob = Blob "def foo\nend\n" "ff7bbbe9495f61d9e1e58c597502d152bab1761e" "methods.rb" (Just Ruby)
|
||||||
|
Loading…
Reference in New Issue
Block a user