* [PATCH 5/7] Bisect: factorise some logging into "bisect_write".
@ 2007-10-14 12:29 Christian Couder
2007-10-14 16:07 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Christian Couder @ 2007-10-14 12:29 UTC (permalink / raw)
To: Junio Hamano, Johannes Schindelin; +Cc: git
Also use "die" instead of "echo >&2 something ; exit 1".
And simplify "bisect_replay".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
git-bisect.sh | 46 +++++++++++++---------------------------------
1 files changed, 13 insertions(+), 33 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index 847250c..e12125f 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -106,12 +106,11 @@ bisect_start() {
die "'$arg' does not appear to be a valid revision"
break
}
- if [ $bad_seen -eq 0 ]; then
- bad_seen=1
- bisect_write 'bad' "$rev"
- else
- bisect_write 'good' "$rev"
- fi
+ case $bad_seen in
+ 0) state='bad' ; bad_seen=1 ;;
+ *) state='good' ;;
+ esac
+ bisect_write "$state" "$rev" 'nolog'
shift
;;
esac
@@ -132,6 +131,7 @@ bisect_write() {
esac
echo "$rev" >"$GIT_DIR/refs/bisect/$tag"
echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
+ test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
}
bisect_bad() {
@@ -145,7 +145,6 @@ bisect_bad() {
usage ;;
esac || exit
bisect_write 'bad' "$rev"
- echo "git-bisect bad $rev" >>"$GIT_DIR/BISECT_LOG"
bisect_auto_next
}
@@ -160,7 +159,6 @@ bisect_good() {
do
rev=$(git rev-parse --verify "$rev^{commit}") || exit
bisect_write 'good' "$rev"
- echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
done
bisect_auto_next
}
@@ -176,7 +174,6 @@ bisect_dunno() {
do
rev=$(git rev-parse --verify "$rev^{commit}") || exit
bisect_write 'dunno' "$rev"
- echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
done
bisect_auto_next
}
@@ -352,10 +349,8 @@ bisect_reset() {
else
branch=master
fi ;;
- 1) git show-ref --verify --quiet -- "refs/heads/$1" || {
- echo >&2 "$1 does not seem to be a valid branch"
- exit 1
- }
+ 1) git show-ref --verify --quiet -- "refs/heads/$1" ||
+ die "$1 does not seem to be a valid branch"
branch="$1" ;;
*)
usage ;;
@@ -375,10 +370,7 @@ bisect_clean_state() {
}
bisect_replay () {
- test -r "$1" || {
- echo >&2 "cannot read $1 for replaying"
- exit 1
- }
+ test -r "$1" || die "cannot read $1 for replaying"
bisect_reset
while read bisect command rev
do
@@ -386,23 +378,11 @@ bisect_replay () {
case "$command" in
start)
cmd="bisect_start $rev"
- eval "$cmd"
- ;;
- good)
- bisect_write 'good' "$rev"
- echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
- ;;
- bad)
- bisect_write 'bad' "$rev"
- echo "git-bisect bad $rev" >>"$GIT_DIR/BISECT_LOG"
- ;;
- dunno)
- bisect_write 'dunno' "$rev"
- echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
- ;;
+ eval "$cmd" ;;
+ good|bad|dunno)
+ bisect_write "$command" "$rev" ;;
*)
- echo >&2 "?? what are you talking about?"
- exit 1 ;;
+ die "?? what are you talking about?" ;;
esac
done <"$1"
bisect_auto_next
--
1.5.3.4.213.g68ad5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5/7] Bisect: factorise some logging into "bisect_write".
2007-10-14 12:29 [PATCH 5/7] Bisect: factorise some logging into "bisect_write" Christian Couder
@ 2007-10-14 16:07 ` Johannes Schindelin
2007-10-14 22:40 ` Lars Hjemli
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-10-14 16:07 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio Hamano, git
Hi,
On Sun, 14 Oct 2007, Christian Couder wrote:
> diff --git a/git-bisect.sh b/git-bisect.sh
> index 847250c..e12125f 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -132,6 +131,7 @@ bisect_write() {
> esac
> echo "$rev" >"$GIT_DIR/refs/bisect/$tag"
> echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
> + test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
> }
Isn't a nolog="$3" missing from bisect_write()?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/7] Bisect: factorise some logging into "bisect_write".
2007-10-14 16:07 ` Johannes Schindelin
@ 2007-10-14 22:40 ` Lars Hjemli
2007-10-15 3:35 ` Christian Couder
0 siblings, 1 reply; 4+ messages in thread
From: Lars Hjemli @ 2007-10-14 22:40 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Christian Couder, Junio Hamano, git
On 10/14/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Sun, 14 Oct 2007, Christian Couder wrote:
> > diff --git a/git-bisect.sh b/git-bisect.sh
> > index 847250c..e12125f 100755
> > --- a/git-bisect.sh
> > +++ b/git-bisect.sh
> > @@ -132,6 +131,7 @@ bisect_write() {
> > esac
> > echo "$rev" >"$GIT_DIR/refs/bisect/$tag"
> > echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
> > + test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
> > }
>
> Isn't a nolog="$3" missing from bisect_write()?
Good catch, I've amended the commit and replaced q/cc/bisect-dunno
with this series.
--
larsh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/7] Bisect: factorise some logging into "bisect_write".
2007-10-14 22:40 ` Lars Hjemli
@ 2007-10-15 3:35 ` Christian Couder
0 siblings, 0 replies; 4+ messages in thread
From: Christian Couder @ 2007-10-15 3:35 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Johannes Schindelin, Junio Hamano, git
Le lundi 15 octobre 2007, Lars Hjemli a écrit :
> On 10/14/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >
> > Isn't a nolog="$3" missing from bisect_write()?
Yes, you are right. I forgot this line when reorganizing patches before
submitting. Thanks.
> Good catch, I've amended the commit and replaced q/cc/bisect-dunno
> with this series.
Thanks,
Christian.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-15 3:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-14 12:29 [PATCH 5/7] Bisect: factorise some logging into "bisect_write" Christian Couder
2007-10-14 16:07 ` Johannes Schindelin
2007-10-14 22:40 ` Lars Hjemli
2007-10-15 3:35 ` Christian Couder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).