webapp: Avoid stomping on existing group and preferred content settings when adding a local repository (or removable drive repository) that already exists.

This does mean that if the webapp is asked to add a git repository on
a removable drive that already exists, but is not yet a git-annex
repository, it will avoid putting it in any group. That unlikely edge case
is ok; the next step is the edit repository screen, which will show it's
not in any group and the user can pick one.
This commit is contained in:
Joey Hess 2014-05-30 12:31:54 -04:00
parent 930d984142
commit de0cba18f6
3 changed files with 13 additions and 6 deletions

View file

@ -337,6 +337,7 @@ getFinishAddDriveR drive = go
setConfig (ConfigKey "core.fsyncobjectfiles") setConfig (ConfigKey "core.fsyncobjectfiles")
(Git.Config.boolConfig True) (Git.Config.boolConfig True)
(u, r) <- a isnew (u, r) <- a isnew
when isnew $
liftAnnex $ setStandardGroup u TransferGroup liftAnnex $ setStandardGroup u TransferGroup
liftAssistant $ syncRemote r liftAssistant $ syncRemote r
redirect $ EditNewRepositoryR u redirect $ EditNewRepositoryR u
@ -459,14 +460,14 @@ initRepo True primary_assistant_repo dir desc mgroup = inDir dir $ do
inRepo $ Git.Command.run inRepo $ Git.Command.run
[Param "config", Param "gc.auto", Param "0"] [Param "config", Param "gc.auto", Param "0"]
getUUID getUUID
{- Repo already exists, could be a non-git-annex repo though. -} {- Repo already exists, could be a non-git-annex repo though so
- still initialize it. -}
initRepo False _ dir desc mgroup = inDir dir $ do initRepo False _ dir desc mgroup = inDir dir $ do
initRepo' desc mgroup initRepo' desc mgroup
getUUID getUUID
initRepo' :: Maybe String -> Maybe StandardGroup -> Annex () initRepo' :: Maybe String -> Maybe StandardGroup -> Annex ()
initRepo' desc mgroup = do initRepo' desc mgroup = unlessM isInitialized $ do
unlessM isInitialized $ do
initialize desc initialize desc
u <- getUUID u <- getUUID
maybe noop (setStandardGroup u) mgroup maybe noop (setStandardGroup u) mgroup

3
debian/changelog vendored
View file

@ -3,6 +3,9 @@ git-annex (5.20140530) UNRELEASED; urgency=medium
* webapp: When adding a new local repository, fix bug that caused its * webapp: When adding a new local repository, fix bug that caused its
group and preferred content to be set in the current repository, group and preferred content to be set in the current repository,
even when not combining. even when not combining.
* webapp: Avoid stomping on existing group and preferred content settings
when adding a local repository (or removable drive repository) that
already exists.
-- Joey Hess <joeyh@debian.org> Thu, 29 May 2014 20:10:59 -0400 -- Joey Hess <joeyh@debian.org> Thu, 29 May 2014 20:10:59 -0400

View file

@ -5,4 +5,7 @@ settings.
Adding existing local repositories or repositories from removable drives Adding existing local repositories or repositories from removable drives
may have the same problems. Didn't check yet. may have the same problems. Didn't check yet.
[[!ttag confirmed]] --[[Joey]] [[!tag confirmed]] --[[Joey]]
> Fixed for local repos and repos on removable drives. Still open for
> ssh remotes (incl gcrypt). --[[Joey]]