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 fastest = fromMaybe [] . headMaybe . Remote.byCost
commit :: CommandStart commit :: CommandStart
commit = next $ next $ do commit = ifM (annexAutoCommit <$> Annex.getGitConfig)
commitmessage <- maybe commitMsg return ( go
=<< Annex.getField (optionName messageOption) , stop
showStart "commit" "" )
Annex.Branch.commit "update" where
ifM isDirect go = next $ next $ do
( do commitmessage <- maybe commitMsg return
void stageDirect =<< Annex.getField (optionName messageOption)
void preCommitDirect showStart "commit" ""
commitStaged Git.Branch.ManualCommit commitmessage Annex.Branch.commit "update"
, do ifM isDirect
inRepo $ Git.Branch.commitQuiet Git.Branch.ManualCommit ( do
[ Param "-a" void stageDirect
, Param "-m" void preCommitDirect
, Param commitmessage commitStaged Git.Branch.ManualCommit commitmessage
] , do
return True inRepo $ Git.Branch.commitQuiet Git.Branch.ManualCommit
) [ Param "-a"
, Param "-m"
, Param commitmessage
]
return True
)
commitMsg :: Annex String commitMsg :: Annex String
commitMsg = do 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. * merge: Avoid creating the synced/master branch.
* add: Stage symlinks the same as git add would, even if they are not a * add: Stage symlinks the same as git add would, even if they are not a
link to annexed content. 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 -- 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` * `annex.autocommit`
Set to false to prevent the git-annex assistant from automatically Set to false to prevent the git-annex assistant and git-annex sync
committing changes to files in the repository. from automatically committing changes to files in the repository.
* `annex.startupscan` * `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. 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 Richard
> [[done]]; extended the annex.autocommit that previously only controlled the
> assistant to also control `git annex sync`. --[[Joey]]