empty preferred content

* Document that settting preferred content to "" is the same as the
  default unset behavior.
* sync: Avoid misleading warning about future preferred content
  transition when preferred content is set to "".
This commit is contained in:
Joey Hess 2024-12-13 13:26:48 -04:00
parent 57d276cabf
commit 7d8558548b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 35 additions and 1 deletions

View file

@ -7,6 +7,10 @@ git-annex (10.20241203) UNRELEASED; urgency=medium
* Work around git hash-object --stdin-paths's odd stripping of carriage * Work around git hash-object --stdin-paths's odd stripping of carriage
return from the end of the line (some windows infection), avoiding return from the end of the line (some windows infection), avoiding
crashing when the repo contains a filename ending in a carriage return. crashing when the repo contains a filename ending in a carriage return.
* Document that settting preferred content to "" is the same as the
default unset behavior.
* sync: Avoid misleading warning about future preferred content
transition when preferred content is set to "".
-- Joey Hess <id@joeyh.name> Mon, 02 Dec 2024 13:41:31 -0400 -- Joey Hess <id@joeyh.name> Mon, 02 Dec 2024 13:41:31 -0400

View file

@ -85,6 +85,7 @@ import Utility.Bloom
import Utility.OptParse import Utility.OptParse
import Utility.Process.Transcript import Utility.Process.Transcript
import Utility.Tuple import Utility.Tuple
import Utility.Matcher
import Control.Concurrent.MVar import Control.Concurrent.MVar
import qualified Data.Map as M import qualified Data.Map as M
@ -1130,7 +1131,7 @@ warnSyncContentTransition o remotes
_ -> do _ -> do
m <- preferredContentMap m <- preferredContentMap
hereu <- getUUID hereu <- getUUID
when (any (`M.member` m) (hereu:map Remote.uuid remotes)) $ when (any (preferredcontentconfigured m) (hereu:map Remote.uuid remotes)) $
showwarning showwarning
where where
showwarning = earlyWarning $ showwarning = earlyWarning $
@ -1140,6 +1141,8 @@ warnSyncContentTransition o remotes
<> " send any content, use --no-content (or -g)" <> " send any content, use --no-content (or -g)"
<> " to prepare for that change." <> " to prepare for that change."
<> " (Or you can configure annex.synccontent)" <> " (Or you can configure annex.synccontent)"
preferredcontentconfigured m u =
maybe False (not . isEmpty . fst) (M.lookup u m)
notOnlyAnnex :: SyncOptions -> Annex Bool notOnlyAnnex :: SyncOptions -> Annex Bool
notOnlyAnnex o = not <$> onlyAnnex o notOnlyAnnex o = not <$> onlyAnnex o

View file

@ -0,0 +1,24 @@
[[!comment format=mdwn
username="joey"
subject="""comment 3"""
date="2024-12-13T16:52:18Z"
content="""
Ah, you're right that this future change in `git-annex sync` behavior is
one way that "anything" is different from not configured.
It turns out that you can just use `git-annex wanted here ""` to get back
the same behavior as the preferred content being unset. I had forgotten
about that, and it was not really documented anywhere, which I've
corrected.
Running `git-annex sync` without --content with preferred content set to ""
currently warns about the transition, but that warning is false. I'm fixing
it to not warn in this case.
As to the heroic measures, .git/annex/index gets merged into whatever is in
the git-annex branch, so you need to delete that file as well as rewriting
the branch. And you need to do this in every single repository that has
received the unwanted change. And since it also auto-merges git-annex
branches from remotes, you probably will want to temporarily remove the
remote tracking branches from git's ref list.
"""]]

View file

@ -30,6 +30,9 @@ a file matches, the repository wants to store its content. If it doesn't,
the repository wants to drop its content (if there are enough copies the repository wants to drop its content (if there are enough copies
elsewhere to allow removing it). elsewhere to allow removing it).
An empty preferred content expression is treated the same as preferred
content not being configured.
# EXPRESSIONS # EXPRESSIONS
* `include=glob` / `exclude=glob` * `include=glob` / `exclude=glob`