Fix behavior of onlyingroup
authorJoey Hess <joeyh@joeyh.name>
Mon, 7 Aug 2023 17:05:11 +0000 (13:05 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 7 Aug 2023 17:05:11 +0000 (13:05 -0400)
Sponsored-by: k0ld on Patreon
CHANGELOG
Limit.hs
doc/bugs/matching_option_--onlyingroup_works_only_partially.mdwn

index f4c75016887fedaf0dae38694fcd314e00fd7f33..54227f46d89fc897666e2eb797b2f79b35f16312 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,9 @@
+git-annex (10.20230803) UNRELEASED; urgency=medium
+
+  * Fix behavior of onlyingroup.
+
+ -- Joey Hess <id@joeyh.name>  Mon, 07 Aug 2023 13:04:13 -0400
+
 git-annex (10.20230802) upstream; urgency=medium
 
   * satisfy: New command that gets/sends/drops content to satisfy
index 952b8885976df872df6280734943a73d3fee02cb..26448594b906271dbbc41f7377fa22f9d3966a25 100644 (file)
--- a/Limit.hs
+++ b/Limit.hs
@@ -509,8 +509,9 @@ limitInAllGroup getgroupmap groupname = Right $ MatchFiles
                present <- S.fromList <$> Remote.keyLocations key
                return $ S.null $ want `S.difference` present
 
-{- Skip files that are only present in repositories that are not in the
- - group. -}
+{- Skip files unless they are present in at least one repository that is in
+ - the specified group, and are not present in any repositories that are not
+ - in the specified group. -}
 addOnlyInGroup :: String -> Annex ()
 addOnlyInGroup groupname = addLimit $ limitOnlyInGroup groupMap groupname
 
@@ -532,7 +533,8 @@ limitOnlyInGroup getgroupmap groupname = Right $ MatchFiles
        check notpresent want key = do
                locs <- S.fromList <$> Remote.keyLocations key
                let present = locs `S.difference` notpresent
-               return $ not $ S.null $ present `S.intersection` want
+               return $ not (S.null $ present `S.intersection` want)
+                       && S.null (S.filter (`S.notMember` want) present)
 
 {- Adds a limit to skip files not using a specified key-value backend. -}
 addInBackend :: String -> Annex ()
index 139162f0ca734a9823bdf9037f10515d2af505c8..706c36b6e7ab63c490ba9852d2aee1e167af54fe 100644 (file)
@@ -537,3 +537,5 @@ backups, where it gives structure to my image-based backup routines, so you coul
 say I'm a believer. :)
 
 [[!meta author=jkniiv]]
+
+> [[fixed|done]] --[[Joey]]