Skip to content

revision: handle pseudo-opts in `--stdin` mode

Patrick Steinhardt requested to merge pks-rev-list-stdin-pseudo-opts into main

While both git-rev-list(1) and git-log(1) support --stdin, they can only read normal revisions. Most notably, it is impossible to use any of the pseudo-opts like --all, --glob= or others.

This makes it hard to use this function in certain scripted scenarios, like when one wants to support queries against specific revisions, but also against reference patterns. While this is theoretically possible by using arguments, this may run into issues once we hit platform limits with sufficiently large queries. And because --stdin cannot handle pseudo-opts, the only alternative would be to use a mixture of arguments and standard input, which is cumbersome.

Implement support for handling pseudo-opts in both commands to support this usecase better. One notable restriction here is that --stdin only supports "stuck" arguments in the form of --glob=foo. This is because "unstuck" arguments would also require us to read the next line, which would add quite some complexity to the code. This restriction should be fine for scripted usage though.

Merge request reports