From cfb055f838da0c51a50224bf759b42fb263dcfec Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Jul 2015 16:36:11 -0400 Subject: sync: When annex.autocommit=false, avoid making any commit of local changes, while still merging with remote to the extent possible. --- Command/Sync.hs | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'Command') diff --git a/Command/Sync.hs b/Command/Sync.hs index 403b463b0..d2c2f95e8 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -151,24 +151,29 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted ) fastest = fromMaybe [] . headMaybe . Remote.byCost commit :: CommandStart -commit = next $ next $ do - commitmessage <- maybe commitMsg return - =<< Annex.getField (optionName messageOption) - showStart "commit" "" - Annex.Branch.commit "update" - ifM isDirect - ( do - void stageDirect - void preCommitDirect - commitStaged Git.Branch.ManualCommit commitmessage - , do - inRepo $ Git.Branch.commitQuiet Git.Branch.ManualCommit - [ Param "-a" - , Param "-m" - , Param commitmessage - ] - return True - ) +commit = ifM (annexAutoCommit <$> Annex.getGitConfig) + ( go + , stop + ) + where + go = next $ next $ do + commitmessage <- maybe commitMsg return + =<< Annex.getField (optionName messageOption) + showStart "commit" "" + Annex.Branch.commit "update" + ifM isDirect + ( do + void stageDirect + void preCommitDirect + commitStaged Git.Branch.ManualCommit commitmessage + , do + inRepo $ Git.Branch.commitQuiet Git.Branch.ManualCommit + [ Param "-a" + , Param "-m" + , Param commitmessage + ] + return True + ) commitMsg :: Annex String commitMsg = do -- cgit v1.2.3