Re: [PATCH v3] bisect: report the found commit with "show"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 13, 2024 at 5:21 PM Peter Krefting <peter@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx>
> ---
> 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.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux