builtin/show: do not prune by pathspecshow-no-prune
commitae9a4d6041df6e01068b016f477e88d5ad5847dd
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>
Thu, 25 Apr 2024 12:24:41 +0000 (25 14:24 +0200)
treee54fdd68e61895d297025e12b0422125d3645581
parent59bd9d5e2578cf886896e33f35e44de2c5a10e1a
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).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
builtin/log.c