summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Logs/PreferredContent.hs17
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/adding_existing_repo_as_remote_in_webapp_may_reset_its_group.mdwn5
3 files changed, 20 insertions, 5 deletions
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs
index ead303f1f..a485ec600 100644
--- a/Logs/PreferredContent.hs
+++ b/Logs/PreferredContent.hs
@@ -18,6 +18,7 @@ module Logs.PreferredContent (
groupPreferredContentMapRaw,
checkPreferredContentExpression,
setStandardGroup,
+ defaultStandardGroup,
preferredRequiredMapsLoad,
) where
@@ -133,10 +134,20 @@ checkPreferredContentExpression expr = case parsedToMatcher tokens of
tokens = exprParser matchAll matchAll emptyGroupMap M.empty Nothing expr
{- Puts a UUID in a standard group, and sets its preferred content to use
- - the standard expression for that group, unless something is already set. -}
+ - the standard expression for that group (unless preferred content is
+ - already set). -}
setStandardGroup :: UUID -> StandardGroup -> Annex ()
setStandardGroup u g = do
groupSet u $ S.singleton $ fromStandardGroup g
- m <- preferredContentMap
- unless (isJust $ M.lookup u m) $
+ unlessM (isJust . M.lookup u <$> preferredContentMap) $
preferredContentSet u "standard"
+
+{- Avoids overwriting the UUID's standard group or preferred content
+ - when it's already been configured. -}
+defaultStandardGroup :: UUID -> StandardGroup -> Annex ()
+defaultStandardGroup u g =
+ unlessM (hasgroup <||> haspc) $
+ setStandardGroup u g
+ where
+ hasgroup = not . S.null <$> lookupGroups u
+ haspc = isJust . M.lookup u <$> preferredContentMap
diff --git a/debian/changelog b/debian/changelog
index 3eb4cf09d..6765dd3dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,7 @@ git-annex (5.20140530) UNRELEASED; urgency=medium
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.
+ when enabling or combining with an already existing remote.
-- Joey Hess <joeyh@debian.org> Thu, 29 May 2014 20:10:59 -0400
diff --git a/doc/bugs/adding_existing_repo_as_remote_in_webapp_may_reset_its_group.mdwn b/doc/bugs/adding_existing_repo_as_remote_in_webapp_may_reset_its_group.mdwn
index 492adfe8b..37a9c2a2e 100644
--- a/doc/bugs/adding_existing_repo_as_remote_in_webapp_may_reset_its_group.mdwn
+++ b/doc/bugs/adding_existing_repo_as_remote_in_webapp_may_reset_its_group.mdwn
@@ -9,3 +9,8 @@ may have the same problems. Didn't check yet.
> Fixed for local repos and repos on removable drives. Still open for
> ssh remotes (incl gcrypt). --[[Joey]]
+
+>> Fixed for ssh (including gcrypt) too.
+>>
+>> Also affected enabling existing special remotes, like webdav; that's
+>> also fixed. [[done]] --[[Joey]]