sync: When annex.autocommit=false, avoid making any commit of local changes, while still merging with remote to the extent possible.

This commit is contained in:
Joey Hess 2015-07-07 16:36:11 -04:00
parent 81ad277a85
commit a51b98cdd5
4 changed files with 30 additions and 20 deletions

View file

@ -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

2
debian/changelog vendored
View file

@ -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

View file

@ -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`

View file

@ -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]]