diff --git a/CHANGELOG b/CHANGELOG index a9e21290ae..0e2f177b0b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,10 @@ git-annex (10.20241203) UNRELEASED; urgency=medium * Work around git hash-object --stdin-paths's odd stripping of carriage return from the end of the line (some windows infection), avoiding 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 Mon, 02 Dec 2024 13:41:31 -0400 diff --git a/Command/Sync.hs b/Command/Sync.hs index 1e38211260..c9436778bd 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -85,6 +85,7 @@ import Utility.Bloom import Utility.OptParse import Utility.Process.Transcript import Utility.Tuple +import Utility.Matcher import Control.Concurrent.MVar import qualified Data.Map as M @@ -1130,7 +1131,7 @@ warnSyncContentTransition o remotes _ -> do m <- preferredContentMap hereu <- getUUID - when (any (`M.member` m) (hereu:map Remote.uuid remotes)) $ + when (any (preferredcontentconfigured m) (hereu:map Remote.uuid remotes)) $ showwarning where showwarning = earlyWarning $ @@ -1140,6 +1141,8 @@ warnSyncContentTransition o remotes <> " send any content, use --no-content (or -g)" <> " to prepare for that change." <> " (Or you can configure annex.synccontent)" + preferredcontentconfigured m u = + maybe False (not . isEmpty . fst) (M.lookup u m) notOnlyAnnex :: SyncOptions -> Annex Bool notOnlyAnnex o = not <$> onlyAnnex o diff --git a/doc/forum/Unable_to_delete_preferred-content.log/comment_3_ef3f7b7c14f44b79785ca9ab5b23ca0f._comment b/doc/forum/Unable_to_delete_preferred-content.log/comment_3_ef3f7b7c14f44b79785ca9ab5b23ca0f._comment new file mode 100644 index 0000000000..4020bb7a08 --- /dev/null +++ b/doc/forum/Unable_to_delete_preferred-content.log/comment_3_ef3f7b7c14f44b79785ca9ab5b23ca0f._comment @@ -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. +"""]] diff --git a/doc/git-annex-preferred-content.mdwn b/doc/git-annex-preferred-content.mdwn index 908b35a95f..68769484dc 100644 --- a/doc/git-annex-preferred-content.mdwn +++ b/doc/git-annex-preferred-content.mdwn @@ -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 elsewhere to allow removing it). +An empty preferred content expression is treated the same as preferred +content not being configured. + # EXPRESSIONS * `include=glob` / `exclude=glob`