[PATCH] Fix git-bisect when show-branch is configured to run with pager

Subsystems: the rest

STALE1875d

3 messages, 2 authors, 2021-07-27 · open the first message on its own page

[PATCH] Fix git-bisect when show-branch is configured to run with pager

From: Oded S via GitGitGadget <hidden>
Date: 2021-07-26 15:01:33

From: Oded Shimon <redacted>

Signed-off-by: Oded Shimon <redacted>
---
    Fix git-bisect when show-branch is configured to run with pager
    
    Signed-off-by: Oded Shimon oded@istraresearch.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1003%2Foded-ist%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1003/oded-ist/master-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1003

 bisect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
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
-- 
gitgitgadget

Re: [PATCH] Fix git-bisect when show-branch is configured to run with pager

From: Christian Couder <hidden>
Date: 2021-07-26 18:13:59

(Sorry, I forgot to keep the mailing list in Cc, in my first reply, so
I am resending it...)

On Mon, Jul 26, 2021 at 5:03 PM Oded S via GitGitGadget
[off-list ref] wrote:
From: Oded Shimon <redacted>
Could you explain a bit more here what is the unwanted behavior this
patch fixes?
Signed-off-by: Oded Shimon <redacted>
---
    Fix git-bisect when show-branch is configured to run with pager
Usually subjects are something like:

bisect: make sure show-branch doesn't use a pager

Otherwise your patch looks good to me!

Thanks!

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

From: Oded S via GitGitGadget <hidden>
Date: 2021-07-27 08:12:47

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>
---
    Fix git-bisect when show-branch is configured to run with pager
    
    Signed-off-by: Oded Shimon oded@istraresearch.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1003%2Foded-ist%2Fmaster-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1003/oded-ist/master-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1003

Range-diff vs v1:

 1:  52eff18191b ! 1:  c193f3a556f Fix git-bisect when show-branch is configured to run with pager
     @@ Metadata
      Author: Oded Shimon [off-list ref]
      
       ## Commit message ##
     -    Fix git-bisect when show-branch is configured to run with pager
     +    bisect: disable pager while invoking show-branch
     +
     +    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 [off-list ref]
      


 bisect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
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
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help