Re: [PATCH v9 4/5] bisect: add the terms old/new

2015-06-26 Thread Matthieu Moy
Christian Couder christian.cou...@gmail.com writes:

 So perhaps you could use a function like:

 write_bisect_terms() {
   if test ! -s $GIT_DIR/BISECT_TERMS
   then
 echo $NAME_BAD $GIT_DIR/BISECT_TERMS 
 echo $NAME_GOOD $GIT_DIR/BISECT_TERMS
   fi
 }

I already had it in the last patch, but reworked the code to introduce
it earlier, and never $GIT_DIR/BISECT_TERMS outside this function.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 4/5] bisect: add the terms old/new

2015-06-25 Thread Matthieu Moy
From: Antoine Delaite antoine.dela...@ensimag.grenoble-inp.fr

When not looking for a regression during a bisect but for a fix or a
change in another given property, it can be confusing to use 'good'
and 'bad'.

This patch introduce `git bisect new` and `git bisect old` as an
alternative to 'bad' and good': the commits which have a certain
property must be marked as `new` and the ones which do not as `old`.

The output will be the first commit after the change in the property.
During a new/old bisect session you cannot use bad/good commands and
vice-versa.

Some commands are still not available for old/new:
 * git rev-list --bisect does not treat the revs/bisect/new and
   revs/bisect/old-SHA1 files.

Old discussions:
- http://thread.gmane.org/gmane.comp.version-control.git/86063
introduced bisect fix unfixed to find fix.
- http://thread.gmane.org/gmane.comp.version-control.git/182398
discussion around bisect yes/no or old/new.
- http://thread.gmane.org/gmane.comp.version-control.git/199758
last discussion and reviews
New discussions:
- http://thread.gmane.org/gmane.comp.version-control.git/271320
( v2 1/7-4/7 )
- http://comments.gmane.org/gmane.comp.version-control.git/271343
( v2 5/7-7/7 )

Signed-off-by: Antoine Delaite antoine.dela...@ensimag.grenoble-inp.fr
Signed-off-by: Louis Stuber stub...@ensimag.grenoble-inp.fr
Signed-off-by: Valentin Duperray valentin.duper...@ensimag.imag.fr
Signed-off-by: Franck Jonas franck.jo...@ensimag.imag.fr
Signed-off-by: Lucien Kong lucien.k...@ensimag.imag.fr
Signed-off-by: Thomas Nguy thomas.n...@ensimag.imag.fr
Signed-off-by: Huynh Khoi Nguyen Nguyen 
huynh-khoi-nguyen.ngu...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@imag.fr
---
 Documentation/git-bisect.txt | 48 ++--
 bisect.c | 11 +++---
 git-bisect.sh| 43 +--
 t/t6030-bisect-porcelain.sh  | 38 +++
 4 files changed, 120 insertions(+), 20 deletions(-)

diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index 4cb52a7..3c3021a 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -18,8 +18,8 @@ on the subcommand:
 
  git bisect help
  git bisect start [--no-checkout] [bad [good...]] [--] [paths...]
- git bisect bad [rev]
- git bisect good [rev...]
+ git bisect (bad|new) [rev]
+ git bisect (good|old) [rev...]
  git bisect skip [(rev|range)...]
  git bisect reset [commit]
  git bisect visualize
@@ -104,6 +104,35 @@ For example, `git bisect reset HEAD` will leave you on the 
current
 bisection commit and avoid switching commits at all, while `git bisect
 reset bisect/bad` will check out the first bad revision.
 
+
+Alternative terms: bisect new and bisect old
+
+
+If you are not at ease with the terms bad and good, perhaps
+because you are looking for the commit that introduced a fix, you can
+alternatively use new and old instead.
+But note that you cannot mix bad and good with new and old.
+
+
+git bisect new [rev]
+
+
+Marks the commit as new, e.g. the bug is no longer there, if you are looking
+for a commit that fixed a bug, or the feature that used to work is now broken
+at this point, if you are looking for a commit that introduced a bug.
+It is the equivalent of git bisect bad [rev].
+
+
+git bisect old [rev...]
+
+
+Marks the commit as old, as the opposite of 'git bisect new'.
+It is the equivalent of git bisect good [rev...].
+
+You must run `git bisect start` without commits as argument and run
+`git bisect new rev`/`git bisect old rev...` after to add the
+commits.
+
 Bisect visualize
 
 
@@ -379,6 +408,21 @@ In this case, when 'git bisect run' finishes, bisect/bad 
will refer to a commit
 has at least one parent whose reachable graph is fully traversable in the sense
 required by 'git pack objects'.
 
+* Look for a fix instead of a regression in the code
++
+
+$ git bisect start
+$ git bisect new HEAD# current commit is marked as new
+$ git bisect old HEAD~10 # the tenth commit from now is marked as old
+
++
+Let's consider the last commit has a given property, and that we are looking
+for the commit which introduced this property. For each commit the bisection
+guide us to, we will test if the property is present. If it is we will mark
+the commit as new with 'git bisect new', otherwise we will mark it as old.
+At the end of the bisect session, the result will be the first new commit (e.g
+the first one with the property).
+
 
 SEE ALSO
 
diff --git a/bisect.c b/bisect.c
index 

Re: [PATCH v9 4/5] bisect: add the terms old/new

2015-06-25 Thread Christian Couder
On Thu, Jun 25, 2015 at 8:50 PM, Matthieu Moy matthieu@imag.fr wrote:

[...]

 @@ -178,7 +183,7 @@ bisect_start() {
 } 
 git rev-parse --sq-quote $@ $GIT_DIR/BISECT_NAMES 
 eval $eval true 
 -   if test $revision_seen -eq 1  test ! -s $GIT_DIR/BISECT_TERMS
 +   if test $must_write_terms -eq 1  test ! -s $GIT_DIR/BISECT_TERMS
 then
 echo $NAME_BAD $GIT_DIR/BISECT_TERMS 
 echo $NAME_GOOD $GIT_DIR/BISECT_TERMS

You are writing BISECT_TERMS here...

 @@ -543,14 +548,22 @@ check_and_set_terms () {
 fi
 NAME_BAD=bad
 NAME_GOOD=good ;;
 +   new|old)
 +   if ! test -s $GIT_DIR/BISECT_TERMS
 +   then
 +   echo new $GIT_DIR/BISECT_TERMS 
 +   echo old $GIT_DIR/BISECT_TERMS
 +   fi
 +   NAME_BAD=new
 +   NAME_GOOD=old ;;

...and here nearly in the same way.

So perhaps you could use a function like:

write_bisect_terms() {
  if test ! -s $GIT_DIR/BISECT_TERMS
  then
echo $NAME_BAD $GIT_DIR/BISECT_TERMS 
echo $NAME_GOOD $GIT_DIR/BISECT_TERMS
  fi
}
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html