Improve error message for empty "zed lake log"
Repro is with Zed commit 8824189.
$ zed -version
Version: v0.29.0-503-g88241892
$ zed lake init
using environment variable ZED_LAKE_ROOT
lake created: /Users/phil/logs
$ zed lake create -orderby ts:desc logs
pool created: logs 1xoqIDTLBuvs5gHbhRrvWPIBj2X
$ zed lake checkout -p logs
Switched to branch "main" on pool "logs"
$ zed lake log
unknown pool metadata type: "log"
As of 12/25/2021, this is still a problem...
As of 3/24/2022, this is still a problem. 😉
Joking aside, the fact I seem to bump into this one each time I come back to the project makes me hope it will be addressed before the v1.0 release. There's too many times when I'm following the Zed READMEs and execute commands on an empty pool (e.g., the meta-data queries) and see these confusing error messages rather than some simpler hint that the pool is empty. I'm nervous of the impression it would give to a user coming to the project for the first time.
Embarrassing. This is surely easy to fix... maybe a palette cleanser for @mattnibs ?
I think we should just change the compiler to not create a pool meta query when the commitID comes back null with no error from the ds.CommitObject() lookup in semPoolWithName. Then make sure the backend returns "empty branch" when running a log metaquery on a null commitID.
Verified in Zed commit eacf7f4.
Now when I query the log on the empty pool, we no longer see an error, which seems reasonable considering there's nothing in the pool to show in the log.
$ zed -version
Version: v1.2.0-127-geacf7f44
$ zed -lake lake init
lake created: lake
$ zed -lake lake create -orderby ts:desc logs
pool created: logs 2HZ0kxHhoEafOahQxQ26hW2kkWr
$ zed -lake lake use logs
Switched to branch "main" on pool "logs"
$ zed -lake lake log
[no output]
$ echo $?
0
Thanks @mattnibs!