add: When adding a dotfile, avoid treating its name as an extension.

This commit is contained in:
Joey Hess 2021-08-03 12:22:58 -04:00
parent 2572950ca7
commit 899983058f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 12 additions and 1 deletions

View file

@ -59,8 +59,11 @@ selectExtension maxlen f
es = filter (not . S.null) $ reverse $
take 2 $ filter (S.all validInExtension) $
takeWhile shortenough $
reverse $ S.split (fromIntegral (ord '.')) (P.takeExtensions f)
reverse $ S.split (fromIntegral (ord '.')) (P.takeExtensions f')
shortenough e = S.length e <= fromMaybe maxExtensionLen maxlen
-- Avoid treating a file ".foo" as having its whole name as an
-- extension.
f' = S.dropWhile (== fromIntegral (ord '.')) (P.takeFileName f)
validInExtension :: Word8 -> Bool
validInExtension c

View file

@ -1,3 +1,9 @@
git-annex (8.20210804) UNRELEASED; urgency=medium
* add: When adding a dotfile, avoid treating its name as an extension.
-- Joey Hess <id@joeyh.name> Tue, 03 Aug 2021 12:22:45 -0400
git-annex (8.20210803) upstream; urgency=medium
* whereused: New command, finds what files use a key, or where a key

View file

@ -59,3 +59,5 @@ git annex list
[[!meta author=yoh]]
[[!tag projects/datalad]]
> [[fixed|done]] --[[Joey]]