zed
zed copied to clipboard
zed: Support git-like HEAD reference
As seen in git, we should add the ability to specify HEAD and HEAD~# when referring to commit ids.
Note that as of current Zed commit 9c0f097, as shown in https://zed.brimdata.io/docs/next/commands/zed#211-query, a plain reference to HEAD does work.
$ zed -version
Version: v1.2.0-49-g9c0f0973
$ curl http://localhost:9867/version
{"version":"v1.2.0-49-g9c0f0973"}
$ zed log
commit 2EloDX0giseXwwffZczD9NQd2PT (HEAD -> main)
Author: [email protected]
Date: 2022-09-14T18:16:52Z
loaded 1 data object
2EloDZSfTLGRgxzZqBlg8Z6Bxzw 78 records in 2952 data bytes
commit 2EloDKxwB4geen0BXT3px8jZiEI
Author: [email protected]
Date: 2022-09-14T18:16:50Z
loaded 1 data object
2EloDEiWNMa5bhiIQUz6qhb2PNI 1021952 records in 40157622 data bytes
commit 2EloCIEEo0R06vy4kMLq7LtaBSi
Author: [email protected]
Date: 2022-09-14T18:16:42Z
loaded 1 data object
2EloCI3vZ5kxgVETseAxAsHJcKK 2 records in 157 data bytes
$ zed query 'from HEAD | count()'
{count:1022032(uint64)}
However, a reference with the tilde does not.
$ zed query 'from HEAD~1 | count()'
error parsing Zed at column 12:
from HEAD~1 | count()
=== ^ ===