Windows: Fix bug in dropping an annexed file, which caused a symlink to be staged that contained backslashes.

This commit is contained in:
Joey Hess 2015-02-09 15:24:33 -04:00
parent 10db6c54df
commit 3e78b83875
5 changed files with 11 additions and 2 deletions

View file

@ -75,6 +75,7 @@ import Types.Key
import Types.UUID
import Types.Difference
import qualified Git
import Git.FilePath
import Annex.DirHashes
{- Conventions:
@ -154,7 +155,7 @@ gitAnnexLink file key r config = do
currdir <- getCurrentDirectory
let absfile = fromMaybe whoops $ absNormPathUnix currdir file
loc <- gitAnnexLocation' key r config False
relPathDirToFile (parentDir absfile) loc
toInternalGitPath <$> relPathDirToFile (parentDir absfile) loc
where
whoops = error $ "unable to normalize " ++ file

View file

@ -330,6 +330,9 @@ test_drop_withremote = intmpclonerepo $ do
git_annex "numcopies" ["1"] @? "numcopies config failed"
git_annex "drop" [annexedfile] @? "drop failed though origin has copy"
annexed_notpresent annexedfile
-- make sure that the correct symlink is staged for the file
-- after drop
git_annex_expectoutput "status" [] []
inmainrepo $ annexed_present annexedfile
test_drop_untrustedremote :: Assertion

View file

@ -66,7 +66,7 @@ absPathFrom :: FilePath -> FilePath -> FilePath
absPathFrom dir path = simplifyPath (combine dir path)
{- On Windows, this converts the paths to unix-style, in order to run
- MissingH's absNormPath on them. Resulting path will use / separators. -}
- MissingH's absNormPath on them. -}
absNormPathUnix :: FilePath -> FilePath -> Maybe FilePath
#ifndef mingw32_HOST_OS
absNormPathUnix dir path = MissingH.absNormPath dir path

2
debian/changelog vendored
View file

@ -12,6 +12,8 @@ git-annex (5.20150206) UNRELEASED; urgency=medium
can actually use them, instead of by all commands.
* import: Avoid checksumming file twice when run in the default
or --duplicate mode.
* Windows: Fix bug in dropping an annexed file, which
caused a symlink to be staged that contained backslashes.
-- Joey Hess <id@joeyh.name> Fri, 06 Feb 2015 13:57:08 -0400

View file

@ -32,3 +32,6 @@ changing the path separator seemingly solves:
### Please provide any additional information below.
no additional info.
> I see that I broke this some time ago. Fixed it now, and added a test
> case. [[done]] --[[Joey]]