aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-11 02:57:48 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-11 02:57:48 -0400
commita41051e59143824921a7e6e3d60bc2b50881d4b4 (patch)
treefcf1f3cadedd053b2ee2206d600350a763526228 /Command
parent9b5b4d3df90eee8e6a9a25bda22f41e82adeaf18 (diff)
remove Eq instance for InodeCache
There are two types of equality here, and which one is right varies, so this forces me to consider and choose between them. Based on this, I learned that the commit in git anex sync was always doing a strong comparison, even when in a repository where the inodes had changed. Fixed that.
Diffstat (limited to 'Command')
-rw-r--r--Command/Add.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index d41a0baea..7100006c6 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -109,11 +109,10 @@ ingest (Just source) = do
backend <- chooseBackend $ keyFilename source
k <- genKey source backend
cache <- liftIO $ genInodeCache $ contentLocation source
- case inodeCache source of
- Nothing -> go k cache
- Just c
- | (Just c == cache) -> go k cache
- | otherwise -> failure
+ case (cache, inodeCache source) of
+ (_, Nothing) -> go k cache
+ (Just newc, Just c) | compareStrong c newc -> go k cache
+ _ -> failure
where
go k cache = ifM isDirect ( godirect k cache , goindirect k cache )