From a0d3a343b52fba63df523d49849b43217ce744ab Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Sep 2011 15:27:45 -0400 Subject: copy --auto Only does copy when numcopies is not yet satisfied. --- Command/Copy.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Command/Copy.hs') 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 -- cgit v1.2.3