fix:journal:include: relative includes from a symlinked file work again [#2503]
This commit is contained in:
parent
784bdb4637
commit
665e2d0a55
@ -319,7 +319,7 @@ includedirectivep iopts = do
|
|||||||
) <|> errorNoArg
|
) <|> errorNoArg
|
||||||
|
|
||||||
let (mprefix,glb) = splitReaderPrefix prefixedglob
|
let (mprefix,glb) = splitReaderPrefix prefixedglob
|
||||||
parentf <- sourcePosFilePath pos -- a little slow, don't do too often
|
parentf <- sourcePosFilePath pos
|
||||||
when (null $ dbg6 (parentf <> " include: glob pattern") glb) errorNoArg
|
when (null $ dbg6 (parentf <> " include: glob pattern") glb) errorNoArg
|
||||||
|
|
||||||
-- Find the file or glob-matched files (just the ones from this include directive), with some IO error checking.
|
-- Find the file or glob-matched files (just the ones from this include directive), with some IO error checking.
|
||||||
@ -379,7 +379,8 @@ includedirectivep iopts = do
|
|||||||
expandedglob <- lift $ expandHomePath globpattern & handleIOError off "failed to expand ~"
|
expandedglob <- lift $ expandHomePath globpattern & handleIOError off "failed to expand ~"
|
||||||
|
|
||||||
-- get the directory of the including file
|
-- get the directory of the including file
|
||||||
let cwd = takeDirectory parentf
|
-- need to canonicalise a symlink parentf so takeDirectory works correctly [#2503]
|
||||||
|
cwd <- fmap takeDirectory <$> liftIO $ canonicalizePath parentf
|
||||||
|
|
||||||
-- Don't allow 3 or more stars.
|
-- Don't allow 3 or more stars.
|
||||||
when ("***" `isInfixOf` expandedglob) $
|
when ("***" `isInfixOf` expandedglob) $
|
||||||
|
|||||||
@ -177,7 +177,6 @@ $ touch /tmp/unreadable.$$ && chmod -r /tmp/unreadable.$$ && hledger -f /tmp/un
|
|||||||
#
|
#
|
||||||
# My ~/.hledger.journal is a symlink to .etc/.hledger.journal
|
# My ~/.hledger.journal is a symlink to .etc/.hledger.journal
|
||||||
|
|
||||||
# ** 21. But I did find this possibly related regression in 1.50.4 & 1.51:
|
# ** 21. But I did find this possibly related regression in 1.50.4 & 1.51 [#2503].
|
||||||
# Failing test:
|
$ hledger -f symlink-to-relative-include.j files
|
||||||
# $ hledger -f symlink-to-relative-include.j files
|
> //
|
||||||
# > //
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user