Fix crash when entering/changing view in a subdirectory of a repo that has a dotfile in its root.

This commit is contained in:
Joey Hess 2016-05-17 13:49:10 -04:00
parent e91037a38b
commit b4ab1fb093
Failed to extract signature
2 changed files with 9 additions and 5 deletions

View file

@ -341,22 +341,24 @@ applyView' mkviewedfile getfilemetadata view = do
liftIO . nukeFile =<< fromRepo gitAnnexViewIndex
uh <- withViewIndex $ inRepo Git.UpdateIndex.startUpdateIndex
forM_ l $ \f -> do
relf <- getTopFilePath <$> inRepo (toTopFilePath f)
go uh relf =<< lookupFile f
topf <- inRepo (toTopFilePath f)
go uh topf =<< lookupFile f
liftIO $ do
void $ stopUpdateIndex uh
void clean
genViewBranch view
where
genviewedfiles = viewedFiles view mkviewedfile -- enables memoization
go uh f (Just k) = do
go uh topf (Just k) = do
metadata <- getCurrentMetaData k
let f = getTopFilePath topf
let metadata' = getfilemetadata f `unionMetaData` metadata
forM_ (genviewedfiles f metadata') $ \fv -> do
f' <- fromRepo $ fromTopFilePath $ asTopFilePath fv
stagesymlink uh f' =<< calcRepo (gitAnnexLink f' k)
go uh f Nothing
| "." `isPrefixOf` f = do
go uh topf Nothing
| "." `isPrefixOf` getTopFilePath topf = do
f <- fromRepo $ fromTopFilePath topf
s <- liftIO $ getSymbolicLinkStatus f
if isSymbolicLink s
then stagesymlink uh f =<< liftIO (readSymbolicLink f)

2
debian/changelog vendored
View file

@ -17,6 +17,8 @@ git-annex (6.20160512) UNRELEASED; urgency=medium
is in a nonstandard place.
* Work around git bug in handling of relative path to GIT_INDEX_FILE
when in a subdirectory of the repository. This affected git annex view.
* Fix crash when entering/changing view in a subdirectory of a repo that
has a dotfile in its root.
-- Joey Hess <id@joeyh.name> Wed, 11 May 2016 16:08:38 -0400