builtin/show: do not prune by pathspecshow-no-prune
commitb0b2138d892ccf7de96d358622f4989ebac3ce90
authorMichael J Gruber <git@drmicha.warpmail.net>
Thu, 31 Mar 2011 09:08:57 +0000 (31 11:08 +0200)
committerMichael J Gruber <git@grubix.eu>
Wed, 19 Jun 2024 15:18:01 +0000 (19 17:18 +0200)
tree89680fd27646c89e0a36d8d26c6c638968a7a0b7
parenteebafb2d7142c956adbfc8ee3e56e4df3a172559
builtin/show: do not prune by pathspec

By design, "git show commit -- path" is not "git show commit:path", and
there is no reason to change that. But "git show commit -- path" simply
returns nothing at all "most of the time" because it prunes by pathspec
even though it does not walk commits. This is pretty useless.

So, turn off commit pruning (but keep diff limiting of course) so that
"git show commit -- path" shows the commit message and the diff that the
commit introduces to path (filtered by path); only the diff will be
empty "most of the time".

As an intended side effect, users mistaking "git show commit -- path"
for "git show commit:path" are automatically reminded that they asked
git to show a commit, not a blob.

In case the user has specified "--do-walk", assume they want the old
behaviour (prune by default).
builtin/log.c