* [PATCH 9/9 v5] bisect: add "--no-replace" option to bisect without using replace refs
@ 2008-11-24 21:20 Christian Couder
0 siblings, 0 replies; only message in thread
From: Christian Couder @ 2008-11-24 21:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Johannes Schindelin, H. Peter Anvin
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
Documentation/git-bisect.txt | 6 +++++-
git-bisect.sh | 26 ++++++++++++++++++++------
t/t6035-bisect-replace.sh | 10 ++++++++++
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index be7518c..8d892bb 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -16,7 +16,7 @@ The command takes various subcommands, and different options depending
on the subcommand:
git bisect help
- git bisect start [<bad> [<good>...]] [--] [<paths>...]
+ git bisect start [--no-replace] [<bad> [<good>...]] [--] [<paths>...]
git bisect bad [<rev>]
git bisect good [<rev>...]
git bisect skip [<rev>...]
@@ -247,6 +247,10 @@ As the refs created by "git bisect replace" can be shared between
developers, this feature might be especially usefull on big projects
where many people often bisect the same code base.
+If you give the `--no-replace` to "git bisect start", then the
+"refs/replace/bisect/*" refs will not be used for the bisection you
+start.
+
Bisect run
~~~~~~~~~~
diff --git a/git-bisect.sh b/git-bisect.sh
index c8d5905..7d09bb0 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -3,7 +3,7 @@
USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|replace|run]'
LONG_USAGE='git bisect help
print this long help message.
-git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
+git bisect start [--no-replace] [<bad> [<good>...]] [--] [<pathspec>...]
reset bisect state and start bisection.
git bisect bad [<rev>]
mark <rev> a known-bad revision.
@@ -119,6 +119,10 @@ bisect_start() {
shift
break
;;
+ --no-replace)
+ shift
+ touch "$GIT_DIR/BISECT_NO_REPLACE"
+ ;;
*)
rev=$(git rev-parse -q --verify "$arg^{commit}") || {
test $has_double_dash -eq 1 &&
@@ -386,6 +390,16 @@ We continue anyway.
EOF
}
+replace_option() {
+ test -f "$GIT_DIR/BISECT_NO_REPLACE" ||
+ echo "--bisect-replace"
+}
+
+no_replace_option() {
+ test ! -f "$GIT_DIR/BISECT_NO_REPLACE" ||
+ echo "--no-bisect-replace"
+}
+
#
# "check_merge_bases" checks that merge bases are not "bad".
#
@@ -401,7 +415,7 @@ check_merge_bases() {
_bad="$1"
_good="$2"
_skip="$3"
- for _mb in $(git merge-base --all --bisect-replace $_bad $_good)
+ for _mb in $(git merge-base --all $(replace_option) $_bad $_good)
do
if is_among "$_mb" "$_good"; then
continue
@@ -436,7 +450,7 @@ check_good_are_ancestors_of_bad() {
# Bisecting with no good rev is ok
test -z "$_good" && return
- _side=$(git rev-list --bisect-replace $_good ^$_bad)
+ _side=$(git rev-list $(replace_option) $_good ^$_bad)
if test -n "$_side"; then
# Return if a checkout was done
check_merge_bases "$_bad" "$_good" "$_skip" || return
@@ -465,9 +479,8 @@ bisect_next() {
test "$?" -eq "1" && return
# Get bisection information
- BISECT_OPT=''
- test -n "$skip" && BISECT_OPT='--bisect-all'
- eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" &&
+ BISECT_OPTS="$(no_replace_option) --bisect-vars ${skip:+--bisect-all}"
+ eval="git rev-list $BISECT_OPTS $good $bad --" &&
eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
eval=$(filter_skipped "$eval" "$skip") &&
eval "$eval" || exit
@@ -534,6 +547,7 @@ bisect_clean_state() {
do
git update-ref -d $ref $hash || exit
done
+ rm -f "$GIT_DIR/BISECT_NO_REPLACE" &&
rm -f "$GIT_DIR/BISECT_EXPECTED_REV" &&
rm -f "$GIT_DIR/BISECT_ANCESTORS_OK" &&
rm -f "$GIT_DIR/BISECT_LOG" &&
diff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh
index f22a2e5..b9cc739 100755
--- a/t/t6035-bisect-replace.sh
+++ b/t/t6035-bisect-replace.sh
@@ -164,6 +164,16 @@ test_expect_success '"git rev-list --no-bisect-replace" works' '
grep $HASH4 rev_list.txt
'
+test_expect_success 'git bisect works with --no-replace' '
+ git bisect start --no-replace $HASH5 $HASH1 &&
+ test "$(git rev-parse --verify HEAD)" = "$HASH3" &&
+ git bisect good &&
+ test "$(git rev-parse --verify HEAD)" = "$HASH4" &&
+ git bisect bad > my_bisect_log.txt &&
+ grep "$HASH4 is first bad commit" my_bisect_log.txt &&
+ git bisect reset
+'
+
#
#
test_done
--
1.5.6.1.1657.g6a50
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-24 21:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 21:20 [PATCH 9/9 v5] bisect: add "--no-replace" option to bisect without using replace refs 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).