From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christian Couder <christian.couder@gmail.com>,
Bartosz Baranowski <bbaranow@redhat.com>,
git@vger.kernel.org
Subject: [PATCH 1/3] bisect: use string arguments to feed internal diff-tree
Date: Fri, 22 Feb 2019 01:20:37 -0500 [thread overview]
Message-ID: <20190222062037.GA10248@sigill.intra.peff.net> (raw)
In-Reply-To: <20190222061949.GA9875@sigill.intra.peff.net>
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>
---
bisect.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/bisect.c b/bisect.c
index 3af955c4bc..8c81859835 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);
}
--
2.21.0.rc2.577.g06bbe9cbd1
next prev parent reply other threads:[~2019-02-22 6:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 10:47 git bisect - good vs bad output is different Bartosz Baranowski
2019-02-21 21:39 ` Junio C Hamano
2019-02-22 6:19 ` [PATCH 0/3] prettier bisect output Jeff King
2019-02-22 6:20 ` Jeff King [this message]
2019-02-22 6:21 ` [PATCH 2/3] bisect: fix internal diff-tree config loading Jeff King
2019-03-03 17:59 ` Christian Couder
2019-03-05 4:15 ` Jeff King
2019-02-22 6:23 ` [PATCH 3/3] bisect: make diff-tree output prettier Jeff King
2019-02-22 17:49 ` Junio C Hamano
2019-02-23 13:44 ` Jeff King
2019-03-03 18:25 ` Christian Couder
2019-02-22 17:39 ` [PATCH 0/3] prettier bisect output Junio C Hamano
2019-03-03 18:33 ` Christian Couder
2019-03-05 4:16 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190222062037.GA10248@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=bbaranow@redhat.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).