webapp: avoid overwriting remote configs when enabling it

Avoid stomping on existing group and preferred content settings
when enabling or combining with an already existing remote.

Two level fix. First, use defaultStandardGroup rather than
setStandardGroup, so if there is an existing configuration in the git-annex
branch, it's not overwritten.

To handle pre-existing ssh remotes (including gcrypt), a second level is
needed, because before syncing with the remote, it's configuration won't be
available locally. (And syncing could take a long time.) So, in this case,
keep track of whether the remote is being created or enabled, and only set
configs when creating it.

This commit was sponsored by Anders Lannerback.
This commit is contained in:
Joey Hess 2014-05-30 14:03:04 -04:00
parent 7089e282b5
commit 9eaabf0382
6 changed files with 52 additions and 29 deletions

View file

@ -339,7 +339,7 @@ getFinishAddDriveR drive = go
(Git.Config.boolConfig True)
(u, r) <- a isnew
when isnew $
liftAnnex $ setStandardGroup u TransferGroup
liftAnnex $ defaultStandardGroup u TransferGroup
liftAssistant $ immediateSyncRemote r
redirect $ EditNewRepositoryR u
mountpoint = T.unpack (mountPoint drive)
@ -471,7 +471,7 @@ initRepo' :: Maybe String -> Maybe StandardGroup -> Annex ()
initRepo' desc mgroup = unlessM isInitialized $ do
initialize desc
u <- getUUID
maybe noop (setStandardGroup u) mgroup
maybe noop (defaultStandardGroup u) mgroup
{- Ensure branch gets committed right away so it is
- available for merging immediately. -}
Annex.Branch.commit "update"