Skip to content

Commit d115b87

Browse files
bkeringitster
authored andcommitted
completion: bisect: complete log opts for visualize subcommand
Arguments passed to the "visualize" subcommand of git-bisect(1) get forwarded to git-log(1). It thus supports the same options as git-log(1) would, but our Bash completion script does not know to handle this. Make completion of porcelain git-log options and option arguments to the visualize subcommand work by calling __git_complete_log_opts when the start of an option to the subcommand is seen (visualize doesn't support any options besides the git-log options). Add test. Signed-off-by: Britton Leo Kerin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a9e5b7a commit d115b87

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,10 @@ _git_bisect ()
14901490
__gitcomp "--term-good --term-old --term-bad --term-new"
14911491
return
14921492
;;
1493+
visualize)
1494+
__git_complete_log_opts
1495+
return
1496+
;;
14931497
bad|new|"$term_bad"|good|old|"$term_good"|reset|skip)
14941498
__git_complete_refs
14951499
;;

t/t9902-completion.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,21 @@ test_expect_success 'git-bisect - options to terms subcommand are candidates' '
13611361
)
13621362
'
13631363

1364+
test_expect_success 'git-bisect - git-log options to visualize subcommand are candidates' '
1365+
(
1366+
cd git-bisect &&
1367+
# The completion used for git-log and here does not complete
1368+
# every git-log option, so rather than hope to stay in sync
1369+
# with exactly what it does we will just spot-test here.
1370+
test_completion "git bisect visualize --sta" <<-\EOF &&
1371+
--stat Z
1372+
EOF
1373+
test_completion "git bisect visualize --summar" <<-\EOF
1374+
--summary Z
1375+
EOF
1376+
)
1377+
'
1378+
13641379
test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' '
13651380
test_completion "git checkout " <<-\EOF
13661381
HEAD Z

0 commit comments

Comments
 (0)