Thread (1 message) 1 message, 1 author, 2021-07-27

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

From: Junio C Hamano <hidden>
Date: 2021-07-27 18:29:09

"Oded S via GitGitGadget" [off-list ref] writes:
From: Oded Shimon <redacted>

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 <redacted>
---
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.


quoted hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help