Re: [PATCH] Re: Make 'git show' more useful
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:47:03
On Tue, 14 Jul 2009, Paolo Bonzini wrote:
So, what about squashing this with Linus's patch? (This is meant to be squashed, which is why this text is not in a cover letter).
I wouldn't squash it.
That said, in the original commit that introduced "no_walk" (ba1d4505), I
said
I was going to add "--no-walk" as a real argument flag to git-rev-list
too, but I'm not sure anybody actually needs it. Although it might be
useful for porcelain, so I left the door open.
and I never actually did it. That was Apr 15, 2006.
The actual "--no-walk" flag was then added over a year later by Dsco, in
commit 8e64006eee ("Teach revision machinery about --no-walk").
Doing a "git log -p -S--no-walk", I have to admit that I don't find a
single actual _use_ of --no-walk. And it obviously wasn't even exported
until a year after it was internally implemented.
So I have to agree with the fact that "--no-walk" and "--do-walk" seem to
be pretty worthless as command line switches. Removing them might be a
good thing.
However, doing some googling, I do actually find examples of it on the
web. And some of them even appear valid:
second_parent=$(git rev-list --no-walk --parents $newrev | sed 's/ /\n/g' | grep -v $newrev | tail --lines=1)
because you can't use "git rev-parse" with --parents (of course, I'm not
at all clear on why it doesn't do
second_parent=$(git rev-parse "$newrev"^2)
but that's really immaterial - the point is that "git rev-parse" is _not_
a replacement for "git rev-list --no-walk").
So I dunno. I think we might as well leave --no-walk and --do-walk around,
even though they are of dubious value. They do mirror the internal
revision walking logic very directly.
Linus