summaryrefslogtreecommitdiff
path: root/Command/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-07 16:36:11 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-07 16:36:11 -0400
commitcfb055f838da0c51a50224bf759b42fb263dcfec (patch)
treed63a161f1728348bb1c7683ef5d122aa928c0cdd /Command/Sync.hs
parent032ee546c9cda12b4b85c05001220d47e8bbba4d (diff)
sync: When annex.autocommit=false, avoid making any commit of local changes, while still merging with remote to the extent possible.
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r--Command/Sync.hs41
1 files changed, 23 insertions, 18 deletions
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