diff options
author | Joey Hess <joey@kitenet.net> | 2012-06-27 13:08:32 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-06-27 13:08:32 -0400 |
commit | 048b64024a14feb0d9ed26abe97c542cfacbc8af (patch) | |
tree | ff17714706a56f2af7b7ef8f550070344fd6b0ff /Git | |
parent | 051c68041b5b7a58e7080403e389d0641691edfd (diff) |
sync: Automatically resolves merge conflicts.
untested, but it compiles :)
Diffstat (limited to 'Git')
-rw-r--r-- | Git/LsFiles.hs | 11 | ||||
-rw-r--r-- | Git/Types.hs | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs index ce7c84aee..321913334 100644 --- a/Git/LsFiles.hs +++ b/Git/LsFiles.hs @@ -88,9 +88,6 @@ data Conflicting v = Conflicting , valThem :: Maybe v } deriving (Show) -isConflicting :: Eq a => Conflicting a -> Bool -isConflicting (Conflicting a b) = a /= b - data Unmerged = Unmerged { unmergedFile :: FilePath , unmergedBlobType :: Conflicting BlobType @@ -124,7 +121,7 @@ parseUnmerged :: String -> Maybe InternalUnmerged parseUnmerged s | null file || length ws < 3 = Nothing | otherwise = do - stage <- readish (ws !! 2) + stage <- readish (ws !! 2) :: Maybe Int unless (stage == 2 || stage == 3) $ fail undefined -- skip stage 1 blobtype <- readBlobType (ws !! 0) @@ -148,9 +145,9 @@ reduceUnmerged c (i:is) = reduceUnmerged (new:c) rest , unmergedSha = Conflicting shaA shaB } findsib templatei [] = ([], deleted templatei) - findsib templatei (i:is) - | ifile i == ifile templatei = (is, i) - | otherwise = (i:is, deleted templatei) + findsib templatei (l:ls) + | ifile l == ifile templatei = (ls, l) + | otherwise = (l:ls, deleted templatei) deleted templatei = templatei { isus = not (isus templatei) , iblobtype = Nothing diff --git a/Git/Types.hs b/Git/Types.hs index e8cdbb442..0c37427c7 100644 --- a/Git/Types.hs +++ b/Git/Types.hs @@ -51,6 +51,7 @@ type Tag = Ref {- Types of objects that can be stored in git. -} data ObjectType = BlobObject | CommitObject | TreeObject + deriving (Eq) instance Show ObjectType where show BlobObject = "blob" @@ -65,6 +66,7 @@ readObjectType _ = Nothing {- Types of blobs. -} data BlobType = FileBlob | ExecutableBlob | SymlinkBlob + deriving (Eq) {- Git uses magic numbers to denote the type of a blob. -} instance Show BlobType where |