From d1a0c7b16fcd41f74def394a55c32f67340670b7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 1 Aug 2019 00:17:02 -0400 Subject: [PATCH] make --in=here fast Use the same optimisation for --in=here as has always been used for --in=. rather than the slow code path that unncessarily queries the git-annex branch. It looks like when "here" got added as an alias for "." back in 2012, I forgot about this place. Also sped up some very unlikely ways of referring to the current repository. Note that, this could in some rare corner case cause a behavior change, if the git-annex branch and inAnnex disagree about whether content is present in the local repository. But --in=. already behaved that way, and the truth on the ground should win also. --- CHANGELOG | 8 ++++++++ Limit.hs | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6f7f9afac6..ae4c2e96ad 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +git-annex (7.20190731) UNRELEASED; urgency=medium + + * Use the same optimisation for --in=here as has always been + used for --in=. rather than the slow code path that unncessarily + queries the git-annex branch. + + -- Joey Hess Thu, 01 Aug 2019 00:11:56 -0400 + git-annex (7.20190730) upstream; urgency=medium * Improved probing when CoW copies can be made between files on the same diff --git a/Limit.hs b/Limit.hs index 6c48100564..67d15400bc 100644 --- a/Limit.hs +++ b/Limit.hs @@ -110,15 +110,15 @@ matchMagic limitname _ _ Nothing _ = {- Adds a limit to skip files not believed to be present - in a specfied repository. Optionally on a prior date. -} addIn :: String -> Annex () -addIn s = addLimit =<< mk +addIn s = do + u <- Remote.nameToUUID name + hereu <- getUUID + addLimit $ if u == hereu && null date + then use inhere + else use (inuuid u) where (name, date) = separate (== '@') s - mk - | name == "." = if null date - then use inhere - else use . inuuid =<< getUUID - | otherwise = use . inuuid =<< Remote.nameToUUID name - use a = return $ Right $ \notpresent -> checkKey (a notpresent) + use a = Right $ checkKey . a inuuid u notpresent key | null date = do us <- Remote.keyLocations key