diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-07 16:36:11 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-07 16:36:11 -0400 |
commit | cfb055f838da0c51a50224bf759b42fb263dcfec (patch) | |
tree | d63a161f1728348bb1c7683ef5d122aa928c0cdd | |
parent | 032ee546c9cda12b4b85c05001220d47e8bbba4d (diff) |
sync: When annex.autocommit=false, avoid making any commit of local changes, while still merging with remote to the extent possible.
-rw-r--r-- | Command/Sync.hs | 41 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/git-annex.mdwn | 4 | ||||
-rw-r--r-- | doc/todo/wishlist:___96__git_annex_sync__96___without_auto-commit.mdwn | 3 |
4 files changed, 30 insertions, 20 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 diff --git a/debian/changelog b/debian/changelog index d6db9d106..12af1736b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,8 @@ git-annex (5.20150618) UNRELEASED; urgency=medium * merge: Avoid creating the synced/master branch. * add: Stage symlinks the same as git add would, even if they are not a link to annexed content. + * sync: When annex.autocommit=false, avoid making any commit of local + changes, while still merging with remote to the extent possible. -- Joey Hess <id@joeyh.name> Thu, 02 Jul 2015 12:31:14 -0400 diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 7a3edf0ef..73894c0d8 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -929,8 +929,8 @@ Here are all the supported configuration settings. * `annex.autocommit` - Set to false to prevent the git-annex assistant from automatically - committing changes to files in the repository. + Set to false to prevent the git-annex assistant and git-annex sync + from automatically committing changes to files in the repository. * `annex.startupscan` diff --git a/doc/todo/wishlist:___96__git_annex_sync__96___without_auto-commit.mdwn b/doc/todo/wishlist:___96__git_annex_sync__96___without_auto-commit.mdwn index b7a7865c8..381626724 100644 --- a/doc/todo/wishlist:___96__git_annex_sync__96___without_auto-commit.mdwn +++ b/doc/todo/wishlist:___96__git_annex_sync__96___without_auto-commit.mdwn @@ -3,3 +3,6 @@ I would like to have way, ideally a per-repo-cloud setting which syncs around au I often have quite complex additions with a mix of `git add` and `git annex add` in various stages of completion; running `git annex sync` regularly to see what state the other repos are in should not autocommit if possible. Richard + +> [[done]]; extended the annex.autocommit that previously only controlled the +> assistant to also control `git annex sync`. --[[Joey]] |