summaryrefslogtreecommitdiff
path: root/Command/Smudge.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-09 15:24:32 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-09 15:24:32 -0400
commit61cab610d572cbfeb798f1ed09da4160b2cbba07 (patch)
tree3bbc7c4caf4f0c5783d0f491ec2e294d0b1de034 /Command/Smudge.hs
parent855c0dd645f53da3ad10320605ef4e5e6276305b (diff)
avoid clean filter trying to annex a pointer file
Diffstat (limited to 'Command/Smudge.hs')
-rw-r--r--Command/Smudge.hs25
1 files changed, 13 insertions, 12 deletions
diff --git a/Command/Smudge.hs b/Command/Smudge.hs
index 746296321..9ce95d4ef 100644
--- a/Command/Smudge.hs
+++ b/Command/Smudge.hs
@@ -54,22 +54,23 @@ smudge file = do
=<< catchMaybeIO (B.readFile content)
stop
--- Clean filter decides if a file should be stored in the annex, and
--- outputs a pointer to its injested content.
+-- Clean filter is fed file content on stdin, decides if a file
+-- should be stored in the annex, and outputs a pointer to its
+-- injested content.
clean :: FilePath -> CommandStart
clean file = do
- ifM (shouldAnnex file)
- ( do
- k <- ingest file
- updateAssociatedFiles k file
- liftIO $ emitPointer k
- , liftIO cat
- )
+ b <- liftIO $ B.hGetContents stdin
+ if isJust (parseLinkOrPointer b)
+ then liftIO $ B.hPut stdout b
+ else ifM (shouldAnnex file)
+ ( do
+ k <- ingest file
+ updateAssociatedFiles k file
+ liftIO $ emitPointer k
+ , liftIO $ B.hPut stdout b
+ )
stop
-cat :: IO ()
-cat = B.hGetContents stdin >>= B.hPut stdout
-
shouldAnnex :: FilePath -> Annex Bool
shouldAnnex file = do
matcher <- largeFilesMatcher