add: When adding a dotfile, avoid treating its name as an extension.
authorJoey Hess <joeyh@joeyh.name>
Tue, 3 Aug 2021 16:22:58 +0000 (12:22 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 3 Aug 2021 16:22:58 +0000 (12:22 -0400)
Backend/Utilities.hs
CHANGELOG
doc/bugs/should_not_assume_entire_name_to_be_an_extension__63__.mdwn

index 16bbbdc9f9d927a2453e163a1c9066b345664a82..ad9b142ab9a66236c4ea1b99ec48f4bd4dc81daa 100644 (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
index 7d192837151b462ec87d1a1d1ea62b205028678a..e80d9b522bc19889f2ac7f6f6fcbcd188b42cd5d 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
index f7e59773d5a01b6937b0748cffb240adb063141c..0dd0355d8ff4e9f6a55c6c152206f8f167df0529 100644 (file)
@@ -59,3 +59,5 @@ git annex list
 
 [[!meta author=yoh]]
 [[!tag projects/datalad]]
+
+> [[fixed|done]] --[[Joey]]