]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/shortlog: don't set up revisions without repo
authorPatrick Steinhardt <ps@pks.im>
Tue, 7 May 2024 04:53:35 +0000 (06:53 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 May 2024 05:50:50 +0000 (22:50 -0700)
commit373bfa6077e76d0b4e8078bc216114dffe3ba430
treea7b821f9b8ae6c5f6f37797a32ed240045e788be
parentab274909d440a43cc03f9f815e9f8d4bba705f1e
builtin/shortlog: don't set up revisions without repo

It is possible to run git-shortlog(1) outside of a repository by passing
it output from git-log(1) via standard input. Obviously, as there is no
repository in that context, it is thus unsupported to pass any revisions
as arguments.

Regardless of that we still end up calling `setup_revisions()`. While
that works alright, it is somewhat strange. Furthermore, this is about
to cause problems when we unset the default object hash.

Refactor the code to only call `setup_revisions()` when we have a
repository. This is safe to do as we already verify that there are no
arguments when running outside of a repository anyway.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/shortlog.c