rev-list: allow missing tips with --missing=[print|allow*]
commit7b644c8c5a67cdda4a15ac91976eb29f5e29b796
authorChristian Couder <christian.couder@gmail.com>
Wed, 14 Feb 2024 14:25:13 +0000 (14 15:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Feb 2024 17:39:14 +0000 (14 09:39 -0800)
treee404c0313d59bb97d43c312d134c4bbfc605c246
parent686101ffc949acc4e840037145a97f647aa9f48c
rev-list: allow missing tips with --missing=[print|allow*]

In 9830926c7d (rev-list: add commit object support in `--missing`
option, 2023-10-27) we fixed the `--missing` option in `git rev-list`
so that it works with with missing commits, not just blobs/trees.

Unfortunately, such a command would still fail with a "fatal: bad
object <oid>" if it is passed a missing commit, blob or tree as an
argument (before the rev walking even begins).

When such a command is used to find the dependencies of some objects,
for example the dependencies of quarantined objects (see the
"QUARANTINE ENVIRONMENT" section in the git-receive-pack(1)
documentation), it would be better if the command would instead
consider such missing objects, especially commits, in the same way as
other missing objects.

If, for example `--missing=print` is used, it would be nice for some
use cases if the missing tips passed as arguments were reported in
the same way as other missing objects instead of the command just
failing.

We could introduce a new option to make it work like this, but most
users are likely to prefer the command to have this behavior as the
default one. Introducing a new option would require another dumb loop
to look for that option early, which isn't nice.

Also we made `git rev-list` work with missing commits very recently
and the command is most often passed commits as arguments. So let's
consider this as a bug fix related to these recent changes.

While at it let's add a NEEDSWORK comment to say that we should get
rid of the existing ugly dumb loops that parse the
`--exclude-promisor-objects` and `--missing=...` options early.

Helped-by: Linus Arver <linusa@google.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/rev-list-options.txt
builtin/rev-list.c
revision.c
t/t6022-rev-list-missing.sh