diff options
Diffstat (limited to 'Command/Copy.hs')
-rw-r--r-- | Command/Copy.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Command/Copy.hs b/Command/Copy.hs index 7d40f438d..125e0bb9f 100644 --- a/Command/Copy.hs +++ b/Command/Copy.hs @@ -9,11 +9,20 @@ module Command.Copy where import Command import qualified Command.Move +import Utility command :: [Command] command = [repoCommand "copy" paramPaths seek "copy content of files to/from another repository"] --- A copy is just a move that does not delete the source file. seek :: [CommandSeek] -seek = [withFilesInGit $ Command.Move.start False] +seek = [withNumCopies start] + +-- A copy is just a move that does not delete the source file. +-- However, --auto mode avoids unnecessary copies. +start :: CommandStartAttrFile +start (file, attr) = isAnnexed file $ \(key, _) -> + autoCopies key (<) numcopies $ + Command.Move.start False file + where + numcopies = readMaybe attr |