summaryrefslogtreecommitdiff
path: root/Command/Mirror.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-03-10 13:12:24 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-03-10 13:35:31 -0400
commit8cb9381befed4174624edfc80e09185c9340b4f6 (patch)
treee5d2041ff38502b1f8a5ef9caa6515cccfcea555 /Command/Mirror.hs
parente230fd58b5f5d5d16f87e1bd5c0f2e553f2ae5a2 (diff)
AssociatedFile newtype
To prevent any further mistakes like 1a497cefb47557f0b4788c606f9071be422b2511 This commit was sponsored by Francois Marier on Patreon.
Diffstat (limited to 'Command/Mirror.hs')
-rw-r--r--Command/Mirror.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Command/Mirror.hs b/Command/Mirror.hs
index d08555e79..7d33d80e9 100644
--- a/Command/Mirror.hs
+++ b/Command/Mirror.hs
@@ -43,16 +43,16 @@ instance DeferredParseClass MirrorOptions where
seek :: MirrorOptions -> CommandSeek
seek o = allowConcurrentOutput $
withKeyOptions (keyOptions o) False
- (startKey o Nothing)
+ (startKey o (AssociatedFile Nothing))
(withFilesInGit $ whenAnnexed $ start o)
(mirrorFiles o)
start :: MirrorOptions -> FilePath -> Key -> CommandStart
start o file k = startKey o afile k (mkActionItem afile)
where
- afile = Just file
+ afile = AssociatedFile (Just file)
-startKey :: MirrorOptions -> Maybe FilePath -> Key -> ActionItem -> CommandStart
+startKey :: MirrorOptions -> AssociatedFile -> Key -> ActionItem -> CommandStart
startKey o afile key ai = case fromToOptions o of
ToRemote r -> checkFailedTransferDirection ai Upload $ ifM (inAnnex key)
( Command.Move.toStart False afile key ai =<< getParsed r
@@ -72,4 +72,6 @@ startKey o afile key ai = case fromToOptions o of
, stop
)
where
- getnumcopies = maybe getNumCopies getFileNumCopies afile
+ getnumcopies = case afile of
+ AssociatedFile Nothing -> getNumCopies
+ AssociatedFile (Just af) -> getFileNumCopies af