Skip to content

Commit f222abd

Browse files
torvaldsgitster
authored andcommitted
Make 'git show' more useful
For some reason, I ended up doing git show HEAD~5.. as an odd way of asking for a log. I realize I should just have used "git log", but at the same time it does make perfect conceptual sense. After all, you _could_ have done git show HEAD HEAD~1 HEAD~2 HEAD~3 HEAD~4 and saying "git show HEAD~5.." is pretty natural. It's not like "git show" only ever showed a single commit (or other object) before either! So conceptually, giving a commit range is a very sensible operation, even though you'd traditionally have used "git log" for that. However, doing that currently results in an error fatal: object ranges do not make sense when not walking revisions which admittedly _also_ makes perfect sense - from an internal git implementation standpoint in 'revision.c'. However, I think that asking to show a range makes sense to a user, while saying "object ranges no not make sense when not walking revisions" only makes sense to a git developer. So on the whole, of the two different "makes perfect sense" behaviors, I think I originally picked the wrong one. And quite frankly, I don't really see anybody actually _depending_ on that error case. So why not change it? So rather than error out, just turn that non-walking error case into a "silently turn on walking" instead. Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4fe1a61 commit f222abd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void mark_parents_uninteresting(struct commit *commit)
133133
static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
134134
{
135135
if (revs->no_walk && (obj->flags & UNINTERESTING))
136-
die("object ranges do not make sense when not walking revisions");
136+
revs->no_walk = 0;
137137
if (revs->reflog_info && obj->type == OBJ_COMMIT &&
138138
add_reflog_for_walk(revs->reflog_info,
139139
(struct commit *)obj, name))

0 commit comments

Comments
 (0)