Fix bug in combination of preferred and required content settings. When one was set to the empty string and the other set to some expression, this bug caused all files to be wanted, instead of only files matching the expression.
Avoid: MAny `MOr` otherexpression Which matches anything.
This commit is contained in:
parent
7088bc8621
commit
16947ef654
5 changed files with 51 additions and 2 deletions
|
@ -77,8 +77,9 @@ preferredRequiredMapsLoad = do
|
|||
<$> Annex.Branch.get l
|
||||
pc <- genmap preferredContentLog =<< groupPreferredContentMapRaw
|
||||
rc <- genmap requiredContentLog M.empty
|
||||
-- Required content is implicitly also preferred content, so OR
|
||||
let m = M.unionWith MOr pc rc
|
||||
-- Required content is implicitly also preferred content, so
|
||||
-- combine.
|
||||
let m = M.unionWith combineMatchers pc rc
|
||||
Annex.changeState $ \s -> s
|
||||
{ Annex.preferredcontentmap = Just m
|
||||
, Annex.requiredcontentmap = Just rc
|
||||
|
|
|
@ -27,6 +27,7 @@ module Utility.Matcher (
|
|||
matchM,
|
||||
matchMrun,
|
||||
isEmpty,
|
||||
combineMatchers,
|
||||
|
||||
prop_matcher_sane
|
||||
) where
|
||||
|
@ -142,6 +143,14 @@ isEmpty :: Matcher a -> Bool
|
|||
isEmpty MAny = True
|
||||
isEmpty _ = False
|
||||
|
||||
{- Combines two matchers, yielding a matcher that will match anything
|
||||
- both do. -}
|
||||
combineMatchers :: Matcher a -> Matcher a -> Matcher a
|
||||
combineMatchers a b
|
||||
| isEmpty a = b
|
||||
| isEmpty b = a
|
||||
| otherwise = a `MOr` b
|
||||
|
||||
prop_matcher_sane :: Bool
|
||||
prop_matcher_sane = all (\m -> match dummy m ()) $ map generate
|
||||
[ [Operation True]
|
||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -26,6 +26,10 @@ git-annex (5.20150825) UNRELEASED; urgency=medium
|
|||
in appropriate places.
|
||||
* Special remotes configured with autoenable=true will be automatically
|
||||
enabled when git-annex init is run.
|
||||
* Fix bug in combination of preferred and required content settings.
|
||||
When one was set to the empty string and the other set to some expression,
|
||||
this bug caused all files to be wanted, instead of only files matching
|
||||
the expression.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 01 Sep 2015 14:46:18 -0700
|
||||
|
||||
|
|
|
@ -360,3 +360,5 @@ On Ubuntu 14.04. All repos are on external USB drives on the same machine except
|
|||
|
||||
|
||||
[1] https://git-annex.branchable.com/forum/git-annex_does_not_respect_preferred_content_settings/
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2015-09-15T16:04:28Z"
|
||||
content="""
|
||||
I find it's not useful to split a conversation between multiple different
|
||||
pages, so this bug is a bit counterproductive.
|
||||
|
||||
But, you made up for that by posting the whole vicfg, which I was somehow
|
||||
able to notice, amoungst all the noise, has this unusual bit:
|
||||
|
||||
required 132503d4-dcde-4790-aabb-ee5ba539a3a0 =
|
||||
# (for ozge)
|
||||
required 1e1d0c4e-b1da-465f-9140-7128a7e3ee13 =
|
||||
# (for irem)
|
||||
required aabc3536-a423-42b6-a234-5f110607296e =
|
||||
# (for yesim)
|
||||
required ba3593c0-ddf1-4433-9916-aa25d1a52895 =
|
||||
# (for buse [origin])
|
||||
required bff7238e-bd92-4929-88a8-c59c1a1dcf03 =
|
||||
|
||||
So, required content has been set to "". It turns out that when this is done,
|
||||
git-annex thinks that all files are preferred! This is because of a bug
|
||||
when combining the required content and preferred content expressions.
|
||||
|
||||
I reproduced this; `git annex get --auto` was not getting a file,
|
||||
which was already known to be in another PodA repository. Then I ran `git annex required . ""`
|
||||
and `git annex get --auto` started getting all files.
|
||||
|
||||
You can't unset a required content setting back to being commented out.
|
||||
A reasonable workaround is to set those to "groupwanted" too. Or get the
|
||||
next git-annex release.
|
||||
"""]]
|
Loading…
Reference in a new issue