add: Consistently treat files in a dotdir as dotfiles, even when ran inside that dotdir

Assistant and smudge also updated.

This does add a small amount of extra work, getting the TopFilePath.
Not enough to be concerned by.

Also improve documentation to make clear that files inside dotdirs are
treated as dotfiles.

Sponsored-by: Eve on Patreon
This commit is contained in:
Joey Hess 2024-11-13 13:42:52 -04:00
parent 1f59dae0bd
commit 876d5b6c6f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
10 changed files with 88 additions and 41 deletions

View file

@ -45,6 +45,7 @@ import qualified Git.Branch
import Utility.Tuple
import Utility.Metered
import qualified Utility.RawFilePath as R
import Git.FilePath
import Data.Time.Clock
import qualified Data.Set as S
@ -319,15 +320,19 @@ handleAdds lockdowndir havelsof largefilematcher annexdotfiles delayadd cs = ret
(LinkChange (Just key))
checksmall change
| not annexdotfiles && dotfile f =
return (Right change)
| otherwise =
ifM (liftAnnex $ checkFileMatcher NoLiveUpdate largefilematcher f)
( return (Left change)
, return (Right change)
)
| not annexdotfiles = do
topfile <- liftAnnex $
getTopFilePath <$> inRepo (toTopFilePath f)
if dotfile topfile
then return (Right change)
else checkmatcher
| otherwise = checkmatcher
where
f = toRawFilePath (changeFile change)
checkmatcher = ifM (liftAnnex $ checkFileMatcher NoLiveUpdate largefilematcher f)
( return (Left change)
, return (Right change)
)
addsmall [] = noop
addsmall toadd = liftAnnex $ void $ tryIO $