git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] bisect: disable pager while invoking show-branch

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 27, 2021, 18:29 UTC
Message-ID
<xmqq5ywvehla.fsf@gitster.g>
In-Reply-To
<pull.1003.v2.git.1627373560881.gitgitgadget@gmail.com>
"Oded S via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 11 quoted lines
> From: Oded Shimon <oded@istraresearch.com>
>
> git-bisect uses show-branch for logging during the bisect process. If the user
> sets an interactive pager for show-branch, this makes bisect hang (wait for
> user input) unexpectedly - so we disable pager with -P.
>
> It's possible that the user would set a pager for git-checkout as well, but an
> interactive pager there would break many more scripts.
>
> Signed-off-by: Oded Shimon <oded@istraresearch.com>
> ---

Nicely described. Now we can discuss if the thought process behind this change makes sense or not with such a clear description.

I do not know if "unexpectedly" is truly unexpected for those who configure show-branch to page, though. After all they wanted their pager to kick in.

In any case, such users are probably better off configuring their pager not to prompt and wait when the output is less than pageful (e.g. "less" has "--quit-if-one-screen" option and 'F' in $LESS environemnt variable triggers this behaviour).

The patch looks good to me.
Thanks.
Show 24 quoted lines
> diff --git a/bisect.c b/bisect.c
> index af2863d044b..c02bcc3359f 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -23,7 +23,7 @@ static struct oid_array skipped_revs;
>  static struct object_id *current_bad_oid;
>  
>  static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
> -static const char *argv_show_branch[] = {"show-branch", NULL, NULL};
> +static const char *argv_show_branch[] = {"-P", "show-branch", NULL, NULL};
>  
>  static const char *term_bad;
>  static const char *term_good;
> @@ -748,7 +748,7 @@ static enum bisect_error bisect_checkout(const struct object_id *bisect_rev, int
>  			return -abs(res);
>  	}
>  
> -	argv_show_branch[1] = bisect_rev_hex;
> +	argv_show_branch[2] = bisect_rev_hex;
>  	res = run_command_v_opt(argv_show_branch, RUN_GIT_CMD);
>  	/*
>  	 * Errors in `run_command()` itself, signaled by res < 0,
>
> base-commit: eb27b338a3e71c7c4079fbac8aeae3f8fbb5c687
Previous: Oded S via GitGitGadget
Message 10 of 10 in “Fix git-bisect when show-branch is configured to run with pager”
  1. Fix git-bisect when show-branch is configured to run with pagerOded S via GitGitGadget, Jul 26, 2021
  2. Christian CouderJul 26, 2021
  3. Junio C HamanoJul 26, 2021
  4. Junio C HamanoJul 27, 2021
  5. Christian CouderJul 28, 2021
  6. Junio C HamanoJul 28, 2021
  7. Re* [PATCH] Fix git-bisect when show-branch is configured to run with pagerJunio C Hamano, Jul 28, 2021
  8. Christian CouderJul 29, 2021
  9. bisect: disable pager while invoking show-branchOded S via GitGitGadget, Jul 27, 2021
  10. Junio C HamanoJul 27, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.