fix view generation code to work when run in a subdirectory; no longer needs to setCurrentDirectory to top of repo
This commit is contained in:
parent
9d75709bf7
commit
d7f1449b2b
2 changed files with 9 additions and 9 deletions
|
@ -340,8 +340,9 @@ applyView' mkviewedfile getfilemetadata view = do
|
||||||
genViewBranch view $ do
|
genViewBranch view $ do
|
||||||
uh <- inRepo Git.UpdateIndex.startUpdateIndex
|
uh <- inRepo Git.UpdateIndex.startUpdateIndex
|
||||||
hasher <- inRepo hashObjectStart
|
hasher <- inRepo hashObjectStart
|
||||||
forM_ l $ \f ->
|
forM_ l $ \f -> do
|
||||||
go uh hasher f =<< Backend.lookupFile f
|
relf <- getTopFilePath <$> inRepo (toTopFilePath f)
|
||||||
|
go uh hasher relf =<< Backend.lookupFile f
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
hashObjectStop hasher
|
hashObjectStop hasher
|
||||||
void $ stopUpdateIndex uh
|
void $ stopUpdateIndex uh
|
||||||
|
@ -352,7 +353,8 @@ applyView' mkviewedfile getfilemetadata view = do
|
||||||
metadata <- getCurrentMetaData k
|
metadata <- getCurrentMetaData k
|
||||||
let metadata' = getfilemetadata f `unionMetaData` metadata
|
let metadata' = getfilemetadata f `unionMetaData` metadata
|
||||||
forM_ (genviewedfiles f metadata') $ \fv -> do
|
forM_ (genviewedfiles f metadata') $ \fv -> do
|
||||||
stagesymlink uh hasher fv =<< inRepo (gitAnnexLink fv k)
|
f' <- fromRepo $ fromTopFilePath $ asTopFilePath fv
|
||||||
|
stagesymlink uh hasher f' =<< inRepo (gitAnnexLink f' k)
|
||||||
go uh hasher f Nothing
|
go uh hasher f Nothing
|
||||||
| "." `isPrefixOf` f = do
|
| "." `isPrefixOf` f = do
|
||||||
s <- liftIO $ getSymbolicLinkStatus f
|
s <- liftIO $ getSymbolicLinkStatus f
|
||||||
|
|
|
@ -53,10 +53,8 @@ mkView params = go =<< inRepo Git.Branch.current
|
||||||
|
|
||||||
checkoutViewBranch :: View -> (View -> Annex Git.Branch) -> CommandCleanup
|
checkoutViewBranch :: View -> (View -> Annex Git.Branch) -> CommandCleanup
|
||||||
checkoutViewBranch view mkbranch = do
|
checkoutViewBranch view mkbranch = do
|
||||||
oldcwd <- liftIO getCurrentDirectory
|
here <- liftIO getCurrentDirectory
|
||||||
|
|
||||||
{- Change to top of repository before creating view branch. -}
|
|
||||||
liftIO . setCurrentDirectory =<< fromRepo Git.repoPath
|
|
||||||
branch <- mkbranch view
|
branch <- mkbranch view
|
||||||
|
|
||||||
showOutput
|
showOutput
|
||||||
|
@ -68,9 +66,9 @@ checkoutViewBranch view mkbranch = do
|
||||||
setView view
|
setView view
|
||||||
{- A git repo can easily have empty directories in it,
|
{- A git repo can easily have empty directories in it,
|
||||||
- and this pollutes the view, so remove them. -}
|
- and this pollutes the view, so remove them. -}
|
||||||
liftIO $ removeemptydirs "."
|
|
||||||
unlessM (liftIO $ doesDirectoryExist oldcwd) $ do
|
|
||||||
top <- fromRepo Git.repoPath
|
top <- fromRepo Git.repoPath
|
||||||
|
liftIO $ removeemptydirs top
|
||||||
|
unlessM (liftIO $ doesDirectoryExist here) $ do
|
||||||
showLongNote (cwdmissing top)
|
showLongNote (cwdmissing top)
|
||||||
return ok
|
return ok
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue