As explained in the previous commit, git-show's DWIM walking mode fails with ranges where propagating the UNINTERESTING marks is needed for correctness. To fix this issue, use a new strategy for of dealing with commits: handle everything else first, then pass all commits to a single revision walker "in bulk". This keeps the UNINTERESTING commits and correctly shows all ranges. Sadly we can use this only when actually walking. In other cases, such as 'git show A B', it would seem more important to keep the order of the objects shown consistent with the command line. There are no such guarantees when running the walker with several commits (even in no-walk mode), so we still feed them one by one. Signed-off-by: Thomas Rast <trast@xxxxxxxxxxxxxxx> --- builtin/log.c | 16 ++++++++++++---- t/t7007-show.sh | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 4f1b42a..26f6c01 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -444,6 +444,7 @@ static void show_rev_tweak_rev(struct rev_info *rev, struct setup_revision_opt * int cmd_show(int argc, const char **argv, const char *prefix) { struct rev_info rev; + struct object_array commits = {0}; struct object_array_entry *objects; struct setup_revision_opt opt; struct pathspec match_all; @@ -505,15 +506,22 @@ int cmd_show(int argc, const char **argv, const char *prefix) rev.shown_one = 1; break; case OBJ_COMMIT: - rev.pending.nr = rev.pending.alloc = 0; - rev.pending.objects = NULL; - add_object_array(o, name, &rev.pending); - ret = cmd_log_walk(&rev); + add_object_array(o, name, &commits); + if (rev.no_walk) { + rev.pending = commits; + ret = cmd_log_walk(&rev); + commits.nr = commits.alloc = 0; + commits.objects = NULL; + } break; default: ret = error(_("Unknown type: %d"), o->type); } } + if (!ret && commits.nr) { + rev.pending = commits; + ret = cmd_log_walk(&rev); + } free(objects); return ret; } diff --git a/t/t7007-show.sh b/t/t7007-show.sh index 1c43963..3936ff7 100755 --- a/t/t7007-show.sh +++ b/t/t7007-show.sh @@ -57,7 +57,7 @@ EOF test_cmp expect actual.filtered ' -test_expect_failure 'showing a range walks (Y shape, ^ last)' ' +test_expect_success 'showing a range walks (Y shape, ^ last)' ' cat >expect <<EOF && commit $(git rev-parse main3) commit $(git rev-parse main2) -- 1.7.11.266.g2b10bc0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html