diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-06 17:24:03 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-06 17:24:03 -0400 |
commit | 9fb5f3edc7e0aec79e38cf588b66e66e4a2bdd3c (patch) | |
tree | d114c9c52685160c2e4c2244676cbd1f5563f9c4 /Git | |
parent | 47646d44b7a391d9439998ba34498f2fb74b4259 (diff) |
log --after=date
Diffstat (limited to 'Git')
-rw-r--r-- | Git/Sha.hs | 3 | ||||
-rw-r--r-- | Git/UnionMerge.hs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Git/Sha.hs b/Git/Sha.hs index 9b3a34650..2a01ede83 100644 --- a/Git/Sha.hs +++ b/Git/Sha.hs @@ -34,3 +34,6 @@ extractSha s {- Size of a git sha. -} shaSize :: Int shaSize = 40 + +nullSha :: Ref +nullSha = Ref $ replicate shaSize '0' diff --git a/Git/UnionMerge.hs b/Git/UnionMerge.hs index d5323af1d..4b335e47b 100644 --- a/Git/UnionMerge.hs +++ b/Git/UnionMerge.hs @@ -103,14 +103,13 @@ calc_merge ch differ repo streamer = gendiff >>= go - a line suitable for update_index that union merges the two sides of the - diff. -} mergeFile :: String -> FilePath -> CatFileHandle -> Repo -> IO (Maybe String) -mergeFile info file h repo = case filter (/= nullsha) [Ref asha, Ref bsha] of +mergeFile info file h repo = case filter (/= nullSha) [Ref asha, Ref bsha] of [] -> return Nothing (sha:[]) -> use sha shas -> use =<< either return (hashObject repo . L.unlines) =<< calcMerge . zip shas <$> mapM getcontents shas where [_colonmode, _bmode, asha, bsha, _status] = words info - nullsha = Ref $ replicate shaSize '0' getcontents s = L.lines <$> catObject h s use sha = return $ Just $ update_index_line sha file |