Re: [PATCH 4/4] builtin/show: do not prune by pathspec
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 1, 2011, 21:50 UTC
- Message-ID
- <7vwrjdej42.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <6509d23c538dfabd4fac8870d29a69b1dd11a516.1301649372.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> 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.
Hmm, I'm very tempted to suggest throwing it into the "don't do it then" basket.
Show 6 quoted lines
> 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).
Compared to "--do-walk", "git show HEAD~5.." would be a much more common way to trigger it, and is a more appropriate justification why you made the non-pruning conditional.
Show 18 quoted lines
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> > --- > builtin/log.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/builtin/log.c b/builtin/log.c > index 916019c..474a76d 100644 > --- a/builtin/log.c > +++ b/builtin/log.c > @@ -420,6 +420,8 @@ int cmd_show(int argc, const char **argv, const char *prefix) > opt.def = "HEAD"; > opt.tweak = show_rev_tweak_rev; > cmd_log_init(argc, argv, prefix, &rev, &opt); > + if (rev.no_walk) > + rev.prune = 0; > > count = rev.pending.nr; > objects = rev.pending.objects;