summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-02-22 06:20:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-28 22:31:35 (GMT)
commit2008f29093ba46e513ca2af7f14f3b75faa7a358 (patch)
tree3230a01ff9985bc2538998d519590034f03b8639 /bisect.c
parent8104ec994ea3849a968b4667d072fedd1e688642 (diff)
downloadgit-2008f29093ba46e513ca2af7f14f3b75faa7a358.zip
git-2008f29093ba46e513ca2af7f14f3b75faa7a358.tar.gz
git-2008f29093ba46e513ca2af7f14f3b75faa7a358.tar.bz2
bisect: use string arguments to feed internal diff-tree
Commit e22278c0a0 (bisect: display first bad commit without forking a new process, 2009-05-28) converted our external call to diff-tree to an internal use of the log_tree_commit(). But rather than individually setting options in the rev_info struct (and explaining in comments how they map to command-line options), we can just pass the command-line options to setup_revisions(). This is shorter, easier to change, and less likely to break if revision.c internals change. Note that we unconditionally set the output format to "raw". The conditional in the original code didn't actually do anything useful, since nobody had an opportunity to set the format to anything. 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.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/bisect.c b/bisect.c
index 3af955c..8c81859 100644
--- a/bisect.c
+++ b/bisect.c
@@ -896,24 +896,15 @@ static void show_diff_tree(struct repository *r,
const char *prefix,
struct commit *commit)
{
+ const char *argv[] = {
+ "diff-tree", "--pretty", "--no-abbrev", "--raw", NULL
+ };
struct rev_info opt;
- /* diff-tree init */
repo_init_revisions(r, &opt, prefix);
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
- opt.abbrev = 0;
- opt.diff = 1;
- /* This is what "--pretty" does */
- opt.verbose_header = 1;
- opt.use_terminator = 0;
- opt.commit_format = CMIT_FMT_DEFAULT;
-
- /* diff-tree init */
- if (!opt.diffopt.output_format)
- opt.diffopt.output_format = DIFF_FORMAT_RAW;
-
- setup_revisions(0, NULL, &opt, NULL);
+ setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL);
log_tree_commit(&opt, commit);
}