aboutsummaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/ReplaceFile.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs
index b090da905..b6126ba7e 100644
--- a/Annex/ReplaceFile.hs
+++ b/Annex/ReplaceFile.hs
@@ -27,7 +27,8 @@ replaceFile :: FilePath -> (FilePath -> Annex ()) -> Annex ()
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