The filename might be at or close to the filename length limit, so using it
as the template for the temp dir would then fail.
replaceFile file action = do
misctmpdir <- fromRepo gitAnnexTmpMiscDir
void $ createAnnexDirectory misctmpdir
- let basetmp = takeFileName file
+ filemax <- liftIO $ fileNameLengthLimit misctmpdir
+ let basetmp = take (filemax `div` 2) (takeFileName file)
withTmpDirIn misctmpdir basetmp $ \tmpdir -> do
let tmpfile = tmpdir <> basetmp
action tmpfile