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,7 +337,8 @@ getFinishAddDriveR drive = go
setConfig (ConfigKey "core.fsyncobjectfiles")
(Git.Config.boolConfig True)
(u, r) <- a isnew
liftAnnex $ setStandardGroup u TransferGroup
when isnew $
liftAnnex $ setStandardGroup u TransferGroup
liftAssistant $ syncRemote r
redirect $ EditNewRepositoryR u
mountpoint = T.unpack (mountPoint drive)
@ -459,15 +460,15 @@ initRepo True primary_assistant_repo dir desc mgroup = inDir dir $ do
inRepo $ Git.Command.run
[Param "config", Param "gc.auto", Param "0"]
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' desc mgroup
getUUID
initRepo' :: Maybe String -> Maybe StandardGroup -> Annex ()
initRepo' desc mgroup = do
unlessM isInitialized $ do
initialize desc
initRepo' desc mgroup = unlessM isInitialized $ do
initialize desc
u <- getUUID
maybe noop (setStandardGroup u) mgroup
{- Ensure branch gets committed right away so it is

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
group and preferred content to be set in the current repository,
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

View file

@ -5,4 +5,7 @@ settings.
Adding existing local repositories or repositories from removable drives
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]]