make sync --no-commit override annex.annex.autocommit
authorJoey Hess <joeyh@joeyh.name>
Fri, 3 Feb 2017 18:36:14 +0000 (14:36 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 3 Feb 2017 18:36:14 +0000 (14:36 -0400)
Command/Sync.hs

index 581cad56208b85c3eba93bf38e825ae1ed6eef32..37fc343e7f3512bbf6483ff806ffd6b2122916b4 100644 (file)
@@ -66,6 +66,7 @@ cmd = withGlobalOptions [jobsOption] $
 data SyncOptions  = SyncOptions
        { syncWith :: CmdParams
        , commitOption :: Bool
+       , noCommitOption :: Bool
        , messageOption :: Maybe String
        , pullOption :: Bool
        , pushOption :: Bool
@@ -80,8 +81,13 @@ optParser desc = SyncOptions
                ( metavar desc
                <> completeRemotes
                ))
-       <*> invertableSwitch "commit" True
-               ( help "avoid git commit" 
+       <*> switch
+               ( long "commit"
+               <> help "commit changes to git"
+               )
+       <*> switch
+               ( long "no-commit"
+               <> help "avoid git commit" 
                )
        <*> optional (strOption
                ( long "message" <> short 'm' <> metavar "MSG"
@@ -246,7 +252,7 @@ commit o = stopUnless shouldcommit $ next $ next $ do
                )
   where
        shouldcommit = pure (commitOption o)
-               <&&> getGitConfigVal annexAutoCommit
+               <||> (pure (not (noCommitOption o)) <&&> getGitConfigVal annexAutoCommit)
 
 commitMsg :: Annex String
 commitMsg = do