summaryrefslogtreecommitdiff
path: root/Command/Smudge.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Smudge.hs')
-rw-r--r--Command/Smudge.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/Command/Smudge.hs b/Command/Smudge.hs
index 1353c2791..b7f18085a 100644
--- a/Command/Smudge.hs
+++ b/Command/Smudge.hs
@@ -48,10 +48,19 @@ smudge file = do
case parseLinkOrPointer b of
Nothing -> liftIO $ B.putStr b
Just k -> do
+ -- A previous unlocked checkout of the file may have
+ -- led to the annex object getting modified;
+ -- don't provide such modified content as it
+ -- will be confusing. inAnnex will detect
+ -- modifications.
+ ifM (inAnnex k)
+ ( do
+ content <- calcRepo (gitAnnexLocation k)
+ liftIO $ B.putStr . fromMaybe b
+ =<< catchMaybeIO (B.readFile content)
+ , liftIO $ B.putStr b
+ )
Database.Keys.addAssociatedFile k file
- content <- calcRepo (gitAnnexLocation k)
- liftIO $ B.hPut stdout . fromMaybe b
- =<< catchMaybeIO (B.readFile content)
stop
-- Clean filter is fed file content on stdin, decides if a file