From c1cfb595d426ebbad6b9778d03ecaef544df776b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 Sep 2017 13:05:43 -0400 Subject: configuration and docs for tracking exports Not yet handled by sync or assistant. This commit was sponsored by Nick Daly on Patreon. --- Command/Export.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Command') diff --git a/Command/Export.hs b/Command/Export.hs index 02c64eadf..81013ad47 100644 --- a/Command/Export.hs +++ b/Command/Export.hs @@ -28,6 +28,7 @@ import Logs.Location import Logs.Export import Database.Export import Messages.Progress +import Config import Utility.Tmp import qualified Data.ByteString.Lazy as L @@ -41,16 +42,22 @@ cmd = command "export" SectionCommon data ExportOptions = ExportOptions { exportTreeish :: Git.Ref , exportRemote :: DeferredParse Remote + , exportTracking :: Bool } optParser :: CmdParamsDesc -> Parser ExportOptions optParser _ = ExportOptions <$> (Git.Ref <$> parsetreeish) <*> (parseRemoteOption <$> parseToOption) + <*> parsetracking where parsetreeish = argument str ( metavar paramTreeish ) + parsetracking = switch + ( long "tracking" + <> help ("track changes to the " ++ paramTreeish) + ) -- To handle renames which swap files, the exported file is first renamed -- to a stable temporary name based on the key. @@ -75,6 +82,10 @@ seek' o r = do db <- openDb (uuid r) ea <- exportActions r recordExportBeginning (uuid r) new + + when (exportTracking o) $ + setConfig (remoteConfig r "export-tracking") + (fromRef $ exportTreeish o) -- Clean up after incomplete export of a tree, in which -- the next block of code below may have renamed some files to -- cgit v1.2.3