# [PATCH 1/2] bash: offer refs for 'git bisect start'

5 messages from 2010-10-10 to 2010-10-10. Participants: SZEDER Gábor, Sverre Rabbelier.
Thread: https://gitlist.dev/t/25413

## SZEDER Gábor, 2010-10-10 21:39

Subject: [PATCH 1/2] bash: offer refs for 'git bisect start'
Message-ID: <1286746774-7877-1-git-send-email-szeder@ira.uka.de>
URL: https://gitlist.dev/e/1286746774-7877-1-git-send-email-szeder%40ira.uka.de

```
The completion script only offered path completion after 'git bisect
start', although bad and good refs could also be specified before the
doubledash.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6756990..eb8ef47 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -912,7 +912,7 @@ _git_bisect ()
 	fi
 
 	case "$subcommand" in
-	bad|good|reset|skip)
+	bad|good|reset|skip|start)
 		__gitcomp "$(__git_refs)"
 		;;
 	*)
-- 
1.7.3.1.148.g2fffa

```

## SZEDER Gábor, 2010-10-10 21:39

Subject: [PATCH 2/2] bash: not all 'git bisect' subcommands make sense when not bisecting
Message-ID: <1286746774-7877-2-git-send-email-szeder@ira.uka.de>
URL: https://gitlist.dev/e/1286746774-7877-2-git-send-email-szeder%40ira.uka.de
In-Reply-To: <1286746774-7877-1-git-send-email-szeder@ira.uka.de>

```
... but only 'start' and 'replay'.  The other commands will either
error out or offer to start bisecting for the user.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index eb8ef47..1262f72 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -907,7 +907,11 @@ _git_bisect ()
 	local subcommands="start bad good skip reset visualize replay log run"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
-		__gitcomp "$subcommands"
+		if [ -f "$(__gitdir)"/BISECT_START ]; then
+			__gitcomp "$subcommands"
+		else
+			__gitcomp "replay start"
+		fi
 		return
 	fi
 
-- 
1.7.3.1.148.g2fffa

```

## Sverre Rabbelier, 2010-10-10 22:05

Subject: Re: [PATCH 2/2] bash: not all 'git bisect' subcommands make sense when not bisecting
Message-ID: <AANLkTi==oCKgw86fy6sPiPuKuownsbob3xXiY=hHhYrQ@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3D%3DoCKgw86fy6sPiPuKuownsbob3xXiY%3DhHhYrQ%40mail.gmail.com
In-Reply-To: <1286746774-7877-2-git-send-email-szeder@ira.uka.de>

```
Heya,

On Sun, Oct 10, 2010 at 23:39, SZEDER Gábor <szeder@ira.uka.de> wrote:
> ... but only 'start' and 'replay'.  The other commands will either
> error out or offer to start bisecting for the user.

I'm not sure, following the same concept "git rebase" should not offer
"--continue" if you're not rebasing. It might just be frustrating for
the user since they might not realize they're not bisecting yet.

-- 
Cheers,

Sverre Rabbelier

```

## SZEDER Gábor, 2010-10-10 22:12

Subject: Re: [PATCH 2/2] bash: not all 'git bisect' subcommands make sense when not bisecting
Message-ID: <20101010221232.GD12529@neumann>
URL: https://gitlist.dev/e/20101010221232.GD12529%40neumann
In-Reply-To: <AANLkTi==oCKgw86fy6sPiPuKuownsbob3xXiY=hHhYrQ@mail.gmail.com>

```
Hi,

On Mon, Oct 11, 2010 at 12:05:52AM +0200, Sverre Rabbelier wrote:
> Heya,
> 
> On Sun, Oct 10, 2010 at 23:39, SZEDER Gábor <szeder@ira.uka.de> wrote:
> > ... but only 'start' and 'replay'.  The other commands will either
> > error out or offer to start bisecting for the user.
> 
> I'm not sure, following the same concept "git rebase" should not offer
> "--continue" if you're not rebasing.

Actually, my patch follows the same concept of 'git rebase', because
that's exactly what the completion function for 'git rebase' does: it
doesn't offer '--continue' (nor '--abort' and '--skip') if you're not
rebasing.

Best,
Gábor

```

## Sverre Rabbelier, 2010-10-10 22:14

Subject: Re: [PATCH 2/2] bash: not all 'git bisect' subcommands make sense when not bisecting
Message-ID: <AANLkTikvSxcjgqmenFDsRuPxcgAse-tJij8R98Wof=JZ@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikvSxcjgqmenFDsRuPxcgAse-tJij8R98Wof%3DJZ%40mail.gmail.com
In-Reply-To: <20101010221232.GD12529@neumann>

```
Heya,

2010/10/11 SZEDER Gábor <szeder@ira.uka.de>:
> Actually, my patch follows the same concept of 'git rebase', because
> that's exactly what the completion function for 'git rebase' does: it
> doesn't offer '--continue' (nor '--abort' and '--skip') if you're not
> rebasing.

Had you only mentioned that in the commit message... ;).

In that case, sounds good!

-- 
Cheers,

Sverre Rabbelier

```
