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

[RFC PATCH 4/6] completion: custom git-bisect terms

From
Britton Leo Kerin <britton.kerin@gmail.com>
Date
Jan 2, 2024, 19:57 UTC
Message-ID
<ed2116c7-88ed-4fa9-9286-89a945ce9e50@smtp-relay.sendinblue.com>
In-Reply-To
<20240102195744.478503-1-britton.kerin@gmail.com>
Signed-off-by: Britton Leo Kerin <britton.kerin@gmail.com>
---
 contrib/completion/git-completion.bash | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4940ad3e24..a09598c5c1 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1581,10 +1581,19 @@ _git_bisect ()
 {
 	__git_has_doubledash && return
 
-	local subcommands="start bad new good old terms skip reset visualize replay log run help"
+	__git_find_repo_path
+
+	local term_bad term_good
+	if [ -f "$__git_repo_path"/BISECT_START ]; then
+		term_bad=`__git bisect terms --term-bad`
+		term_good=`__git bisect terms --term-good`
+	fi
+
+	local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help"
+
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
+
 	if [ -z "$subcommand" ]; then
-		__git_find_repo_path
 		if [ -f "$__git_repo_path"/BISECT_START ]; then
 			__gitcomp "$subcommands"
 		else
@@ -1617,7 +1626,7 @@ _git_bisect ()
 	esac
 
 	case "$subcommand" in
-	bad|new|good|old|reset|skip|start)
+	bad|new|"$term_bad"|good|old|"$term_good"|reset|skip|start)
 		__git_complete_refs
 		;;
 	*)
-- 
2.43.0
Previous: Britton Leo KerinNext: Britton Leo Kerin
Message 3 of 6 in “completion: complete new old actions, start opts”
  1. 1/6 completion: complete new old actions, start optsBritton Leo Kerin, Jan 2, 2024
  2. 2/6 completion: git-log opts to bisect visualizeBritton Leo Kerin, Jan 2, 2024
  3. 4/6 completion: custom git-bisect termsBritton Leo Kerin, Jan 2, 2024
  4. 3/6 completion: move to maintain define-before-useBritton Leo Kerin, Jan 2, 2024
  5. 6/6 completion: add commentBritton Leo Kerin, Jan 2, 2024
  6. 5/6 completion: recognize but do not complete 'view'Britton Leo Kerin, Jan 2, 2024

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.