Previously LEDGER_FILE=foo hledger add did, but hledger -f foo add didn't.
Now they both consistently will error if given a glob
(a path contining [, {, *, or ?) that matches nothing,
rather than auto-creating a file with a glob-like name.
Hledger.Utils.IO:
expandPathOrGlob
This restores the pre-1.50.3 behaviour of add and import, which once
again auto-create a missing file (specified by -f or LEDGER_FILE or
the builtin default path) rather than giving an error.
This fixes#2514 and refines the fix for [#2485].
There's also an improvement: they no longer create it unconditionally at the start;
they create lazily, when they have data to write.
Hledger.Read:
defaultExistingJournalPath
defaultExistingJournalPathSafely
readPossibleJournalFile
Hledger.Cli.Utils:
withPossibleJournal
Replace O(n log n) re-sorting of all prices on every valuation date
with O(log n) indexed lookups. By pre-building sorted price indexes
once at startup using O(n log n) time, we avoid redundant work
during reports.
This significantly improves performance for --value=end,COMM with daily
reports over long periods and large price databases.
Implementation:
- PriceIndex maps commodity pairs to a Map from date to effective
price, enabling O(log n) temporal lookups via M.lookupLE.
- DefaultValuationIndex provides efficient resolution of destination
commodities using the same temporal logic.
- makePriceGraph is updated to consume these indexes.
Signed-off-by: Oleg Bulatov <oleg@bulatov.me>
The nightly tag is no longer usable, having been used in a test of
immutable releases on Github. The branch/tag/workflow/release is
now "testbin", intended for publishing unreleased binaries for testing.
When including a literal path, don't use the Glob library at all.
Glob seems to read attributes of all files in a directory,
which disturbs build tools like tup which detect dependencies
based on filesystem operations.
Since 1.50.3, canonicalizePath was being called wastefully when
processing journals with many nested include files and/or many matches
for include glob paths. On a slow filesystem, with unusually
many includes, this might have been quite noticeable.
Now we canonicalise each file path just once as it is encountered,
avoiding the wasted IO work.