# [PATCH] Bisect visualize: use "for-each-ref" to list all good refs.

4 messages from 2007-11-14 to 2007-11-15. Participants: Christian Couder, Junio C Hamano, Johannes Sixt.
Thread: https://gitlist.dev/t/10860

## Christian Couder, 2007-11-14 04:50

Subject: [PATCH] Bisect visualize: use "for-each-ref" to list all good refs.
Message-ID: <20071114055036.2c5ae793.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20071114055036.2c5ae793.chriscool%40tuxfamily.org

```
In bisect_visualize, "cd $GIT_DIR/refs && echo bisect/good-*" was
still used instead of "git for-each-ref". This patch fix it.

We now pass "refs/bisect/bad" and "--not refs/bisect/good-<rev>"
instead of "bisect/bad" and "--not bisect/good-<rev>" to gitk,
but it seems to work.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-bisect.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 1ed44e5..8d75d91 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -326,8 +326,8 @@ bisect_next() {
 
 bisect_visualize() {
 	bisect_next_check fail
-	not=`cd "$GIT_DIR/refs" && echo bisect/good-*`
-	eval gitk bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
+	not=$(git for-each-ref --format='%(refname)' "refs/bisect/good-*")
+	eval gitk refs/bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
 }
 
 bisect_reset() {
-- 
1.5.3.5.629.g807b3

```

## Junio C Hamano, 2007-11-14 08:11

Subject: Re: [PATCH] Bisect visualize: use "for-each-ref" to list all good refs.
Message-ID: <7voddxkzzw.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7voddxkzzw.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20071114055036.2c5ae793.chriscool@tuxfamily.org>

```
Christian Couder <chriscool@tuxfamily.org> writes:

> In bisect_visualize, "cd $GIT_DIR/refs && echo bisect/good-*" was
> still used instead of "git for-each-ref". This patch fix it.

Heh, it still uses

	echo "$rev" >"$GIT_DIR/refs/bisect/$tag"

So we are still _very_ much tied to refs on the filesystem not
in packed-refs.

Even worse is that bisect_clean_state uses

	rm -fr "$GIT_DIR/refs/bisect"

so if you ever pack your refs in the middle of bisection and
then clean the state, you will still carry the old good set of
commits that are somewhat hard to cull.

```

## Johannes Sixt, 2007-11-14 10:05

Subject: Re: [PATCH] Bisect visualize: use "for-each-ref" to list all good refs.
Message-ID: <473AC87E.90107@viscovery.net>
URL: https://gitlist.dev/e/473AC87E.90107%40viscovery.net
In-Reply-To: <7voddxkzzw.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano schrieb:
> Even worse is that bisect_clean_state uses
> 
> 	rm -fr "$GIT_DIR/refs/bisect"
> 
> so if you ever pack your refs in the middle of bisection and
> then clean the state, you will still carry the old good set of
> commits that are somewhat hard to cull.

Heh. I think I'd done this once, and couldn't get rid of those refs with 
'git-bisect reset'. Now I know why.

-- Hannes

```

## Christian Couder, 2007-11-15 06:43

Subject: Re: [PATCH] Bisect visualize: use "for-each-ref" to list all good refs.
Message-ID: <200711150743.59716.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200711150743.59716.chriscool%40tuxfamily.org
In-Reply-To: <7voddxkzzw.fsf@gitster.siamese.dyndns.org>

```
Le mercredi 14 novembre 2007, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > In bisect_visualize, "cd $GIT_DIR/refs && echo bisect/good-*" was
> > still used instead of "git for-each-ref". This patch fix it.
>
> Heh, it still uses
>
> 	echo "$rev" >"$GIT_DIR/refs/bisect/$tag"
>
> So we are still _very_ much tied to refs on the filesystem not
> in packed-refs.

Yes, but someone (guess who) started to modernize git-bisect by 
using "for-each-ref":

http://git.kernel.org/?p=git/git.git;a=commitdiff;h=6fecf1915c5fd0b14e2ca2ec9e1a6b620abfb5c2
http://git.kernel.org/?p=git/git.git;a=commitdiff;h=0a5280a9f444c33b0e4ebf2f073df5899c112cf8

so I thought it would be fine to finish this modernization work.

> Even worse is that bisect_clean_state uses
>
> 	rm -fr "$GIT_DIR/refs/bisect"
>
> so if you ever pack your refs in the middle of bisection and
> then clean the state, you will still carry the old good set of
> commits that are somewhat hard to cull.

Thanks for reminding me of this problem. I just posted a patch that should 
fix it.

Best regards,
Christian.

```
