summaryrefslogtreecommitdiff
path: root/Database/Keys.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-14 16:37:25 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-14 16:37:25 -0400
commitf9dfeaf801da2e4d5879b3de5895dc3cef68a329 (patch)
tree56c23f16087ccd475e66a66d2b98abbec4e04e07 /Database/Keys.hs
parent3c72634bb790eac407291b579afb4f501b3a4a11 (diff)
Fix storing of filenames of v6 unlocked files when the filename is not representable in the current locale.
This is a mostly backwards compatable change. I broke backwards compatability in the case where a filename starts with double-quote. That seems likely to be very rare, and v6 unlocked files are a new feature anyway, and fsck needs to fix missing associated file mappings anyway. So, I decided that is good enough. The encoding used is to just show the String when it contains a problem character. While that adds some overhead to addAssociatedFile and removeAssociatedFile, those are not called very often. This approach has minimal decode overhead, because most filenames won't be encoded that way, and it only has to look for the leading double-quote to skip the expensive read. So, getAssociatedFiles remains fast. I did consider using ByteString instead, but getting a FilePath converted with all chars intact, even surrigates, is difficult, and it looks like instance PersistField ByteString uses Text, which I don't trust for problem encoded data. It would probably be slower too, and it would make the database less easy to inspect manually.
Diffstat (limited to 'Database/Keys.hs')
-rw-r--r--Database/Keys.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Database/Keys.hs b/Database/Keys.hs
index f3d349dc0..246ccd191 100644
--- a/Database/Keys.hs
+++ b/Database/Keys.hs
@@ -174,7 +174,7 @@ scanAssociatedFiles = whenM (isJust <$> inRepo Git.Branch.current) $
add h i k = liftIO $ flip SQL.queueDb h $
void $ insertUnique $ SQL.Associated
(toIKey k)
- (getTopFilePath $ Git.LsTree.file i)
+ (toSFilePath $ getTopFilePath $ Git.LsTree.file i)
{- Stats the files, and stores their InodeCaches. -}
storeInodeCaches :: Key -> [FilePath] -> Annex ()