git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Peter Krefting <peter@softwolves.pp.se>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>,
	 Christian Couder <christian.couder@gmail.com>,
	Michael Osipov <michael.osipov@innomotics.com>
Subject: Re: [PATCH v3] bisect: report the found commit with "show"
Date: Sat, 13 Apr 2024 21:28:40 -0400	[thread overview]
Message-ID: <CAPig+cQu15HzZkeT3+oG3U7iFax5_GYUB=uqwuJxshw-PD=VHQ@mail.gmail.com> (raw)
In-Reply-To: <965ae345-fd58-c46c-5a7a-de181e901f21@softwolves.pp.se>

On Sat, Apr 13, 2024 at 5:21 PM Peter Krefting <peter@softwolves.pp.se> wrote:
> When "git bisect" finds the first bad commit and shows it to the user,
> it calls "git diff-tree" to do so, whose output is meant to be stable
> and deliberately ignores end-user customizations.
>
> As the output is supposed to be consumed by humans, replace this with
> a call to "git show". This command honors configuration options (such
> as "log.date" and "log.mailmap") and other UI improvements (renames
> are detected).
>
> Pass some hard-coded options to "git show" to make the output similar
> to the one we are replacing, such as showing a patch summary only.
>
> Signed-off-By: Peter Krefting <peter@softwolves.pp.se>
> ---
> diff --git a/bisect.c b/bisect.c
> @@ -959,23 +959,30 @@ static enum bisect_error check_good_are_ancestors_of_bad(struct repository *r,
> +static void show_commit(struct commit *commit)
>   {
> +       /* Call git show with --no-pager, as it would otherwise
> +        * paginate the "git show" output only, not the output
> +        * from bisect_next_all(); this can be fixed by moving
> +        * it into a --format parameter, but that would override
> +        * the user's default options for "git show", which we
> +        * are trying to honour. */
> +       strvec_pushl(&show.args,
> +                    "--no-pager",
> +                    "show",
> +                    "--stat",
> +                    "--summary",
> +                    "--no-abbrev-commit",
> +                    "--diff-merges=first-parent",
> +                    oid_to_hex(&commit->object.oid), NULL);

Style nit: On this project, multi-line comments are formatted like this:

    /*
     * This is a multi-line
     * comment.
    */

It also feels slightly odd to place each option on its own line in the
call to strvec_pushl() but then place the terminating NULL on the same
line as the oid_to_hex() call. But that's a minor and subjective point
hardly worth mentioning.


  reply	other threads:[~2024-04-14  1:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13 20:14 [PATCH v3] bisect: report the found commit with "show" Peter Krefting
2024-04-14  1:28 ` Eric Sunshine [this message]
2024-04-15 21:24   ` Junio C Hamano
2024-04-15 21:33     ` Eric Sunshine
2024-04-16  5:13       ` Jeff King
2024-04-16 19:44         ` Peter Krefting

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='CAPig+cQu15HzZkeT3+oG3U7iFax5_GYUB=uqwuJxshw-PD=VHQ@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=michael.osipov@innomotics.com \
    --cc=peff@peff.net \
    --cc=peter@softwolves.pp.se \
    /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).