Skip to content

Commit 2008f29

Browse files
peffgitster
authored andcommitted
bisect: use string arguments to feed internal diff-tree
Commit e22278c (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8104ec9 commit 2008f29

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

bisect.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -896,24 +896,15 @@ static void show_diff_tree(struct repository *r,
896896
const char *prefix,
897897
struct commit *commit)
898898
{
899+
const char *argv[] = {
900+
"diff-tree", "--pretty", "--no-abbrev", "--raw", NULL
901+
};
899902
struct rev_info opt;
900903

901-
/* diff-tree init */
902904
repo_init_revisions(r, &opt, prefix);
903905
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
904-
opt.abbrev = 0;
905-
opt.diff = 1;
906906

907-
/* This is what "--pretty" does */
908-
opt.verbose_header = 1;
909-
opt.use_terminator = 0;
910-
opt.commit_format = CMIT_FMT_DEFAULT;
911-
912-
/* diff-tree init */
913-
if (!opt.diffopt.output_format)
914-
opt.diffopt.output_format = DIFF_FORMAT_RAW;
915-
916-
setup_revisions(0, NULL, &opt, NULL);
907+
setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL);
917908
log_tree_commit(&opt, commit);
918909
}
919910

0 commit comments

Comments
 (0)