]> git.ipfire.org Git - thirdparty/git.git/commit
revision: handle pseudo-opts in `--stdin` mode
authorPatrick Steinhardt <ps@pks.im>
Thu, 15 Jun 2023 14:39:59 +0000 (16:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jun 2023 19:09:31 +0000 (12:09 -0700)
commitc40f0b78771ecc8696014e2e0aa37e78417b4723
tree6507c00163a5237029b13ad8d04c93f5a8c61524
parentaf37a209ad76ce760becc0d2c2fac63c2022e730
revision: handle pseudo-opts in `--stdin` mode

While both git-rev-list(1) and git-log(1) support `--stdin`, it only
accepts commits and files. Most notably, it is impossible to pass any of
the pseudo-opts like `--all`, `--glob=` or others via stdin.

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.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/rev-list-options.txt
revision.c
t/t6017-rev-list-stdin.sh