diff options
author | Jeff King <peff@peff.net> | 2019-02-22 07:23:28 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-02-28 23:31:38 +0100 |
commit | b02be8b901bc65de1b75014c0dade67b233569ff (patch) | |
tree | b95eefa197b77013e7df2beb9da9df9460cfd0c1 /bisect.c | |
parent | bisect: fix internal diff-tree config loading (diff) | |
download | git-b02be8b901bc65de1b75014c0dade67b233569ff.tar.xz git-b02be8b901bc65de1b75014c0dade67b233569ff.zip |
bisect: make diff-tree output prettier
After completing a bisection, we print out the commit we found using an
internal version of diff-tree. The result is aesthetically lacking:
- it shows a raw diff, which is generally less informative for human
readers than "--stat --summary" (which we already decided was nice
for humans in format-patch's output).
- by not abbreviating hashes, the result is likely to wrap on most
people's terminals
- we don't use "-r", so if the commit touched files in a directory,
you only get to see the top-level directory mentioned
- we don't specify "--cc" or similar, so merges print nothing (not
even the commit message!)
Even though bisect might be driven by scripts, there's no reason to
consider this part of the output as machine-readable (if anything, the
initial "$hash is the first bad commit" might be parsed, but we won't
touch that here). Let's make it prettier and more informative for a
human reading the output.
While we're tweaking the options, let's also switch to using the diff
"ui" config. If we're accepting that this is human-readable output, then
we should respect the user's options for how to display it.
Note that we have to touch a few tests in t6030. These check bisection
in a corrupted repository (it's missing a subtree). They didn't fail
with the previous code, because it didn't actually recurse far enough in
the diff to find the broken tree. But now we'll see the corruption and
complain.
Adjusting the tests to expect the die() is the best fix. We still
confirm that we're able to bisect within the broken repo. And we'll
still print "$hash is the first bad commit" as usual before dying;
showing that is a reasonable outcome in a corrupt repository (and was
what might happen already, if the root tree was corrupt).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bisect.c')
-rw-r--r-- | bisect.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -897,11 +897,11 @@ static void show_diff_tree(struct repository *r, struct commit *commit) { const char *argv[] = { - "diff-tree", "--pretty", "--no-abbrev", "--raw", NULL + "diff-tree", "--pretty", "--stat", "--summary", "--cc", NULL }; struct rev_info opt; - git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ + git_config(git_diff_ui_config, NULL); repo_init_revisions(r, &opt, prefix); setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL); |