All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/7] Bisect: factorise "bisect_write_*" functions.
@ 2007-10-14 12:29 Christian Couder
  2007-10-23 22:13 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Couder @ 2007-10-14 12:29 UTC (permalink / raw)
  To: Junio Hamano, Johannes Schindelin; +Cc: git

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

diff --git a/git-bisect.sh b/git-bisect.sh
index 94534e6..847250c 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -108,9 +108,9 @@ bisect_start() {
 		}
 		if [ $bad_seen -eq 0 ]; then
 		    bad_seen=1
-		    bisect_write_bad "$rev"
+		    bisect_write 'bad' "$rev"
 		else
-		    bisect_write_good "$rev"
+		    bisect_write 'good' "$rev"
 		fi
 		shift
 		;;
@@ -122,6 +122,18 @@ bisect_start() {
 	bisect_auto_next
 }
 
+bisect_write() {
+	state="$1"
+	rev="$2"
+	case "$state" in
+		bad)		tag="$state" ;;
+		good|dunno)	tag="$state"-"$rev" ;;
+		*)		die "Bad bisect_write argument: $state" ;;
+	esac
+	echo "$rev" >"$GIT_DIR/refs/bisect/$tag"
+	echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
+}
+
 bisect_bad() {
 	bisect_autostart
 	case "$#" in
@@ -132,17 +144,11 @@ bisect_bad() {
 	*)
 		usage ;;
 	esac || exit
-	bisect_write_bad "$rev"
+	bisect_write 'bad' "$rev"
 	echo "git-bisect bad $rev" >>"$GIT_DIR/BISECT_LOG"
 	bisect_auto_next
 }
 
-bisect_write_bad() {
-	rev="$1"
-	echo "$rev" >"$GIT_DIR/refs/bisect/bad"
-	echo "# bad: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
-}
-
 bisect_good() {
 	bisect_autostart
 	case "$#" in
@@ -153,18 +159,12 @@ bisect_good() {
 	for rev in $revs
 	do
 		rev=$(git rev-parse --verify "$rev^{commit}") || exit
-		bisect_write_good "$rev"
+		bisect_write 'good' "$rev"
 		echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
 	done
 	bisect_auto_next
 }
 
-bisect_write_good() {
-	rev="$1"
-	echo "$rev" >"$GIT_DIR/refs/bisect/good-$rev"
-	echo "# good: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
-}
-
 bisect_dunno() {
 	bisect_autostart
 	case "$#" in
@@ -175,18 +175,12 @@ bisect_dunno() {
 	for rev in $revs
 	do
 		rev=$(git rev-parse --verify "$rev^{commit}") || exit
-		bisect_write_dunno "$rev"
+		bisect_write 'dunno' "$rev"
 		echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
 	done
 	bisect_auto_next
 }
 
-bisect_write_dunno() {
-	rev="$1"
-	echo "$rev" >"$GIT_DIR/refs/bisect/dunno-$rev"
-	echo "# dunno: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
-}
-
 bisect_next_check() {
 	missing_good= missing_bad=
 	git show-ref -q --verify refs/bisect/bad || missing_bad=t
@@ -395,15 +389,15 @@ bisect_replay () {
 			eval "$cmd"
 			;;
 		good)
-			bisect_write_good "$rev"
+			bisect_write 'good' "$rev"
 			echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
 			;;
 		bad)
-			bisect_write_bad "$rev"
+			bisect_write 'bad' "$rev"
 			echo "git-bisect bad $rev" >>"$GIT_DIR/BISECT_LOG"
 			;;
 		dunno)
-			bisect_write_dunno "$rev"
+			bisect_write 'dunno' "$rev"
 			echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
 			;;
 		*)
-- 
1.5.3.4.213.g68ad5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/7] Bisect: factorise "bisect_write_*" functions.
  2007-10-14 12:29 [PATCH 4/7] Bisect: factorise "bisect_write_*" functions Christian Couder
@ 2007-10-23 22:13 ` Junio C Hamano
  2007-10-23 22:29   ` J. Bruce Fields
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-10-23 22:13 UTC (permalink / raw)
  To: Christian Couder; +Cc: Johannes Schindelin, git

Sort of offtopic, but is "factorise" a correct verb here?  I
thought "factorise" is to express a non prime number as the
product of prime numbers.

"refactor" is the act of splitting and merging pieces of
functions for better reuse, isn't it?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/7] Bisect: factorise "bisect_write_*" functions.
  2007-10-23 22:13 ` Junio C Hamano
@ 2007-10-23 22:29   ` J. Bruce Fields
  2007-10-23 22:36   ` Andreas Ericsson
  2007-10-24  4:09   ` Christian Couder
  2 siblings, 0 replies; 5+ messages in thread
From: J. Bruce Fields @ 2007-10-23 22:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Christian Couder, Johannes Schindelin, git

On Tue, Oct 23, 2007 at 03:13:12PM -0700, Junio C Hamano wrote:
> Sort of offtopic, but is "factorise" a correct verb here?  I
> thought "factorise" is to express a non prime number as the
> product of prime numbers.

"Factor" is a perfectly good verb on its own, no need for the "ise"
normally.

--b.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/7] Bisect: factorise "bisect_write_*" functions.
  2007-10-23 22:13 ` Junio C Hamano
  2007-10-23 22:29   ` J. Bruce Fields
@ 2007-10-23 22:36   ` Andreas Ericsson
  2007-10-24  4:09   ` Christian Couder
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Ericsson @ 2007-10-23 22:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Christian Couder, Johannes Schindelin, git

Junio C Hamano wrote:
> Sort of offtopic, but is "factorise" a correct verb here?  I
> thought "factorise" is to express a non prime number as the
> product of prime numbers.
> 

It's the reverse of expanding brackets, like so:
2x² + x - 3 = (2x + 3)(x - 1)

> "refactor" is the act of splitting and merging pieces of
> functions for better reuse, isn't it?
> 

Yes.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/7] Bisect: factorise "bisect_write_*" functions.
  2007-10-23 22:13 ` Junio C Hamano
  2007-10-23 22:29   ` J. Bruce Fields
  2007-10-23 22:36   ` Andreas Ericsson
@ 2007-10-24  4:09   ` Christian Couder
  2 siblings, 0 replies; 5+ messages in thread
From: Christian Couder @ 2007-10-24  4:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git

Le mercredi 24 octobre 2007, Junio C Hamano a écrit :
> Sort of offtopic, but is "factorise" a correct verb here?  I
> thought "factorise" is to express a non prime number as the
> product of prime numbers.

English is not my mother tongue so I very often make mistakes.
Sorry about that.

Anyway my prefered online dictionary finds it:

http://www.wordreference.com/definition/factorise

> "refactor" is the act of splitting and merging pieces of
> functions for better reuse, isn't it?

Yes, it would be better.

I used "factorise" because as a french native speaker, I am always tempted 
to use word that sound the same as their french translation.

By the way I realised that the "bisect_write" function is still 
missing 'nolog="$3"', so I will send an updated patch.

Thanks,
Christian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-10-24  4:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-14 12:29 [PATCH 4/7] Bisect: factorise "bisect_write_*" functions Christian Couder
2007-10-23 22:13 ` Junio C Hamano
2007-10-23 22:29   ` J. Bruce Fields
2007-10-23 22:36   ` Andreas Ericsson
2007-10-24  4:09   ` Christian Couder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.