summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-06 12:49:41 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-06 12:49:41 -0400
commit2c0c99eea6ac82e42b46fc9e9c2541736862fd47 (patch)
treef833bbf81f69172bf54f4f7b89452a78742a5a0e
parenta5628f8cfcb44f8a1c2dfe2fd268c7f547ee51b6 (diff)
Windows: Fix an over-long temp directory name.
-rw-r--r--Annex/ReplaceFile.hs11
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows.mdwn2
-rw-r--r--doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows/comment_1_fafaff54e55e0b82df52656d8afb1c3e._comment8
4 files changed, 22 insertions, 0 deletions
diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs
index 4b1b2b5db..7cb4fbdea 100644
--- a/Annex/ReplaceFile.hs
+++ b/Annex/ReplaceFile.hs
@@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Annex.ReplaceFile where
import Annex.Common
@@ -27,8 +29,17 @@ replaceFile :: FilePath -> (FilePath -> Annex ()) -> Annex ()
replaceFile file action = do
misctmpdir <- fromRepo gitAnnexTmpMiscDir
void $ createAnnexDirectory misctmpdir
+#ifndef mingw32_HOST_OS
+ -- Use part of the filename as the template for the temp
+ -- directory. This does not need to be unique, but it
+ -- makes it more clear what this temp directory is for.
filemax <- liftIO $ fileNameLengthLimit misctmpdir
let basetmp = take (filemax `div` 2) (takeFileName file)
+#else
+ -- Windows has limits on the whole path length, so keep
+ -- it short.
+ let basetmp = "t"
+#endif
withTmpDirIn misctmpdir basetmp $ \tmpdir -> do
let tmpfile = tmpdir </> basetmp
action tmpfile
diff --git a/debian/changelog b/debian/changelog
index 2856be2be..55c46079a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ git-annex (6.20160420) UNRELEASED; urgency=medium
* stack.yaml: Enable explicit-setup-deps.
* Windows: Fix several bugs in propigation of changes from the adjusted
branch back to the master branch.
+ * Windows: Fix an over-long temp directory name.
* map: Hide dead repositories that are not connected to the graph.
* map: Changed colors; red is used for untrusted repositories and grey
for dead.
diff --git a/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows.mdwn b/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows.mdwn
index b175b6dfe..4c6c85e51 100644
--- a/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows.mdwn
+++ b/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows.mdwn
@@ -35,3 +35,5 @@ OS: Windows 10
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes, managing 30000 files, on operating systems other than Windows though...
+
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows/comment_1_fafaff54e55e0b82df52656d8afb1c3e._comment b/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows/comment_1_fafaff54e55e0b82df52656d8afb1c3e._comment
new file mode 100644
index 000000000..b672dea8a
--- /dev/null
+++ b/doc/bugs/Excessively_long_temp_names_preventing___34__get__34___on_Windows/comment_1_fafaff54e55e0b82df52656d8afb1c3e._comment
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2016-05-06T16:46:22Z"
+ content="""
+Thanks for reporting this. I can't fix all the too long path problems
+on windows currently, but I can fix this particular one at least.
+"""]]