[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
#!/bin/sh
|
2005-12-11 12:55:49 +03:00
|
|
|
|
2007-03-23 10:49:59 +03:00
|
|
|
USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'
|
2007-04-04 09:12:02 +04:00
|
|
|
LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
|
|
|
|
reset bisect state and start bisection.
|
|
|
|
git bisect bad [<rev>]
|
|
|
|
mark <rev> a known-bad revision.
|
|
|
|
git bisect good [<rev>...]
|
|
|
|
mark <rev>... known-good revisions.
|
|
|
|
git bisect next
|
|
|
|
find next bisection to test and check it out.
|
|
|
|
git bisect reset [<branch>]
|
|
|
|
finish bisection search and go back to branch.
|
|
|
|
git bisect visualize
|
|
|
|
show bisect status in gitk.
|
|
|
|
git bisect replay <logfile>
|
|
|
|
replay bisection log.
|
|
|
|
git bisect log
|
|
|
|
show bisect log.
|
2007-10-22 09:48:36 +04:00
|
|
|
git bisect skip [<rev>...]
|
|
|
|
mark <rev>... untestable revisions.
|
2007-04-04 09:12:02 +04:00
|
|
|
git bisect run <cmd>...
|
|
|
|
use <cmd>... to automatically bisect.'
|
2005-12-11 12:55:49 +03:00
|
|
|
|
2005-11-24 11:12:11 +03:00
|
|
|
. git-sh-setup
|
2007-02-06 01:03:27 +03:00
|
|
|
require_work_tree
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
|
2005-11-28 04:42:05 +03:00
|
|
|
sq() {
|
2006-07-08 19:32:04 +04:00
|
|
|
@@PERL@@ -e '
|
2005-11-28 04:42:05 +03:00
|
|
|
for (@ARGV) {
|
|
|
|
s/'\''/'\'\\\\\'\''/g;
|
|
|
|
print " '\''$_'\''";
|
|
|
|
}
|
|
|
|
print "\n";
|
|
|
|
' "$@"
|
|
|
|
}
|
|
|
|
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_autostart() {
|
|
|
|
test -d "$GIT_DIR/refs/bisect" || {
|
|
|
|
echo >&2 'You need to start by "git bisect start"'
|
|
|
|
if test -t 0
|
|
|
|
then
|
|
|
|
echo >&2 -n 'Do you want me to do it for you [Y/n]? '
|
|
|
|
read yesno
|
|
|
|
case "$yesno" in
|
|
|
|
[Nn]*)
|
|
|
|
exit ;;
|
|
|
|
esac
|
|
|
|
bisect_start
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bisect_start() {
|
|
|
|
#
|
|
|
|
# Verify HEAD. If we were bisecting before this, reset to the
|
|
|
|
# top-of-line master first!
|
|
|
|
#
|
2007-07-03 09:52:14 +04:00
|
|
|
head=$(GIT_DIR="$GIT_DIR" git symbolic-ref HEAD) ||
|
2005-10-01 01:26:57 +04:00
|
|
|
die "Bad HEAD - I need a symbolic ref"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
case "$head" in
|
2007-03-23 23:15:21 +03:00
|
|
|
refs/heads/bisect)
|
2006-02-12 19:06:14 +03:00
|
|
|
if [ -s "$GIT_DIR/head-name" ]; then
|
|
|
|
branch=`cat "$GIT_DIR/head-name"`
|
|
|
|
else
|
|
|
|
branch=master
|
2007-10-22 09:48:23 +04:00
|
|
|
fi
|
2006-02-12 19:06:14 +03:00
|
|
|
git checkout $branch || exit
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
;;
|
|
|
|
refs/heads/*)
|
2006-02-12 19:06:14 +03:00
|
|
|
[ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
|
|
|
|
echo "$head" | sed 's#^refs/heads/##' >"$GIT_DIR/head-name"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
;;
|
|
|
|
*)
|
2005-10-01 01:26:57 +04:00
|
|
|
die "Bad HEAD - strange symbolic ref"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#
|
|
|
|
# Get rid of any old bisect state
|
|
|
|
#
|
2007-04-04 09:12:02 +04:00
|
|
|
bisect_clean_state
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
mkdir "$GIT_DIR/refs/bisect"
|
2007-04-04 09:12:02 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Check for one bad and then some good revisions.
|
|
|
|
#
|
|
|
|
has_double_dash=0
|
|
|
|
for arg; do
|
|
|
|
case "$arg" in --) has_double_dash=1; break ;; esac
|
|
|
|
done
|
|
|
|
orig_args=$(sq "$@")
|
|
|
|
bad_seen=0
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
arg="$1"
|
|
|
|
case "$arg" in
|
|
|
|
--)
|
2007-10-22 09:48:23 +04:00
|
|
|
shift
|
2007-04-04 09:12:02 +04:00
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
2007-10-22 09:48:23 +04:00
|
|
|
rev=$(git rev-parse --verify "$arg^{commit}" 2>/dev/null) || {
|
2007-04-04 09:12:02 +04:00
|
|
|
test $has_double_dash -eq 1 &&
|
|
|
|
die "'$arg' does not appear to be a valid revision"
|
|
|
|
break
|
|
|
|
}
|
2007-10-24 09:01:13 +04:00
|
|
|
case $bad_seen in
|
|
|
|
0) state='bad' ; bad_seen=1 ;;
|
|
|
|
*) state='good' ;;
|
|
|
|
esac
|
|
|
|
bisect_write "$state" "$rev" 'nolog'
|
2007-10-22 09:48:23 +04:00
|
|
|
shift
|
2007-04-04 09:12:02 +04:00
|
|
|
;;
|
|
|
|
esac
|
2007-10-22 09:48:23 +04:00
|
|
|
done
|
2007-04-04 09:12:02 +04:00
|
|
|
|
|
|
|
sq "$@" >"$GIT_DIR/BISECT_NAMES"
|
2007-04-17 08:40:50 +04:00
|
|
|
echo "git-bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG"
|
2007-04-04 09:12:02 +04:00
|
|
|
bisect_auto_next
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
}
|
|
|
|
|
2007-10-24 09:01:05 +04:00
|
|
|
bisect_write() {
|
|
|
|
state="$1"
|
|
|
|
rev="$2"
|
2007-10-24 09:01:13 +04:00
|
|
|
nolog="$3"
|
2007-10-24 09:01:05 +04:00
|
|
|
case "$state" in
|
|
|
|
bad) tag="$state" ;;
|
|
|
|
good|skip) 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"
|
2007-10-24 09:01:13 +04:00
|
|
|
test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
|
2007-10-24 09:01:05 +04:00
|
|
|
}
|
|
|
|
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_bad() {
|
|
|
|
bisect_autostart
|
2005-08-30 23:45:41 +04:00
|
|
|
case "$#" in
|
|
|
|
0)
|
2007-07-03 09:52:14 +04:00
|
|
|
rev=$(git rev-parse --verify HEAD) ;;
|
2005-08-30 23:45:41 +04:00
|
|
|
1)
|
2007-07-03 09:52:14 +04:00
|
|
|
rev=$(git rev-parse --verify "$1^{commit}") ;;
|
2005-08-30 23:45:41 +04:00
|
|
|
*)
|
|
|
|
usage ;;
|
|
|
|
esac || exit
|
2007-10-24 09:01:05 +04:00
|
|
|
bisect_write 'bad' "$rev"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_auto_next
|
|
|
|
}
|
|
|
|
|
|
|
|
bisect_good() {
|
|
|
|
bisect_autostart
|
2007-10-22 09:48:23 +04:00
|
|
|
case "$#" in
|
2007-07-03 09:52:14 +04:00
|
|
|
0) revs=$(git rev-parse --verify HEAD) || exit ;;
|
|
|
|
*) revs=$(git rev-parse --revs-only --no-flags "$@") &&
|
2005-08-30 23:45:41 +04:00
|
|
|
test '' != "$revs" || die "Bad rev input: $@" ;;
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
esac
|
|
|
|
for rev in $revs
|
|
|
|
do
|
2007-07-03 09:52:14 +04:00
|
|
|
rev=$(git rev-parse --verify "$rev^{commit}") || exit
|
2007-10-24 09:01:05 +04:00
|
|
|
bisect_write 'good' "$rev"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
done
|
|
|
|
bisect_auto_next
|
|
|
|
}
|
|
|
|
|
2007-10-22 09:48:36 +04:00
|
|
|
bisect_skip() {
|
|
|
|
bisect_autostart
|
|
|
|
case "$#" in
|
|
|
|
0) revs=$(git rev-parse --verify HEAD) || exit ;;
|
|
|
|
*) revs=$(git rev-parse --revs-only --no-flags "$@") &&
|
|
|
|
test '' != "$revs" || die "Bad rev input: $@" ;;
|
|
|
|
esac
|
|
|
|
for rev in $revs
|
|
|
|
do
|
|
|
|
rev=$(git rev-parse --verify "$rev^{commit}") || exit
|
2007-10-24 09:01:05 +04:00
|
|
|
bisect_write 'skip' "$rev"
|
2007-10-22 09:48:36 +04:00
|
|
|
done
|
|
|
|
bisect_auto_next
|
|
|
|
}
|
|
|
|
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_next_check() {
|
2007-04-06 10:27:44 +04:00
|
|
|
missing_good= missing_bad=
|
|
|
|
git show-ref -q --verify refs/bisect/bad || missing_bad=t
|
|
|
|
test -n "$(git for-each-ref "refs/bisect/good-*")" || missing_good=t
|
2007-04-06 09:51:14 +04:00
|
|
|
|
2007-04-06 10:27:44 +04:00
|
|
|
case "$missing_good,$missing_bad,$1" in
|
|
|
|
,,*)
|
|
|
|
: have both good and bad - ok
|
|
|
|
;;
|
|
|
|
*,)
|
|
|
|
# do not have both but not asked to fail - just report.
|
|
|
|
false
|
|
|
|
;;
|
|
|
|
t,,good)
|
|
|
|
# have bad but not good. we could bisect although
|
|
|
|
# this is less optimum.
|
|
|
|
echo >&2 'Warning: bisecting only with a bad commit.'
|
|
|
|
if test -t 0
|
|
|
|
then
|
|
|
|
printf >&2 'Are you sure [Y/n]? '
|
|
|
|
case "$(read yesno)" in [Nn]*) exit 1 ;; esac
|
|
|
|
fi
|
|
|
|
: bisect without good...
|
|
|
|
;;
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
*)
|
2007-04-06 10:27:44 +04:00
|
|
|
THEN=''
|
|
|
|
test -d "$GIT_DIR/refs/bisect" || {
|
|
|
|
echo >&2 'You need to start by "git bisect start".'
|
|
|
|
THEN='then '
|
|
|
|
}
|
|
|
|
echo >&2 'You '$THEN'need to give me at least one good' \
|
|
|
|
'and one bad revisions.'
|
|
|
|
echo >&2 '(You can use "git bisect bad" and' \
|
|
|
|
'"git bisect good" for that.)'
|
|
|
|
exit 1 ;;
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
bisect_auto_next() {
|
2005-09-18 00:51:03 +04:00
|
|
|
bisect_next_check && bisect_next || :
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
}
|
|
|
|
|
2007-10-22 09:48:36 +04:00
|
|
|
filter_skipped() {
|
|
|
|
_eval="$1"
|
|
|
|
_skip="$2"
|
|
|
|
|
|
|
|
if [ -z "$_skip" ]; then
|
|
|
|
eval $_eval
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Let's parse the output of:
|
|
|
|
# "git rev-list --bisect-vars --bisect-all ..."
|
|
|
|
eval $_eval | while read hash line
|
|
|
|
do
|
|
|
|
case "$VARS,$FOUND,$TRIED,$hash" in
|
|
|
|
# We display some vars.
|
|
|
|
1,*,*,*) echo "$hash $line" ;;
|
|
|
|
|
|
|
|
# Split line.
|
|
|
|
,*,*,---*) ;;
|
|
|
|
|
|
|
|
# We had nothing to search.
|
|
|
|
,,,bisect_rev*)
|
|
|
|
echo "bisect_rev="
|
|
|
|
VARS=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
# We did not find a good bisect rev.
|
|
|
|
# This should happen only if the "bad"
|
|
|
|
# commit is also a "skip" commit.
|
|
|
|
,,*,bisect_rev*)
|
|
|
|
echo "bisect_rev=$TRIED"
|
|
|
|
VARS=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
# We are searching.
|
|
|
|
,,*,*)
|
|
|
|
TRIED="${TRIED:+$TRIED|}$hash"
|
|
|
|
case "$_skip" in
|
|
|
|
*$hash*) ;;
|
|
|
|
*)
|
|
|
|
echo "bisect_rev=$hash"
|
|
|
|
echo "bisect_tried=\"$TRIED\""
|
|
|
|
FOUND=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
# We have already found a rev to be tested.
|
|
|
|
,1,*,bisect_rev*) VARS=1 ;;
|
|
|
|
,1,*,*) ;;
|
|
|
|
|
|
|
|
# ???
|
|
|
|
*) die "filter_skipped error " \
|
|
|
|
"VARS: '$VARS' " \
|
|
|
|
"FOUND: '$FOUND' " \
|
|
|
|
"TRIED: '$TRIED' " \
|
|
|
|
"hash: '$hash' " \
|
|
|
|
"line: '$line'"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
exit_if_skipped_commits () {
|
|
|
|
_tried=$1
|
|
|
|
if expr "$_tried" : ".*[|].*" > /dev/null ; then
|
|
|
|
echo "There are only 'skip'ped commit left to test."
|
|
|
|
echo "The first bad commit could be any of:"
|
|
|
|
echo "$_tried" | sed -e 's/[|]/\n/g'
|
|
|
|
echo "We cannot bisect more!"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_next() {
|
2007-10-22 09:48:23 +04:00
|
|
|
case "$#" in 0) ;; *) usage ;; esac
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_autostart
|
2007-04-06 10:27:44 +04:00
|
|
|
bisect_next_check good
|
|
|
|
|
2007-10-22 09:48:36 +04:00
|
|
|
skip=$(git for-each-ref --format='%(objectname)' \
|
|
|
|
"refs/bisect/skip-*" | tr '[\012]' ' ') || exit
|
|
|
|
|
|
|
|
BISECT_OPT=''
|
|
|
|
test -n "$skip" && BISECT_OPT='--bisect-all'
|
|
|
|
|
2007-07-03 09:52:14 +04:00
|
|
|
bad=$(git rev-parse --verify refs/bisect/bad) &&
|
2007-04-06 10:27:44 +04:00
|
|
|
good=$(git for-each-ref --format='^%(objectname)' \
|
|
|
|
"refs/bisect/good-*" | tr '[\012]' ' ') &&
|
2007-10-22 09:48:36 +04:00
|
|
|
eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" &&
|
2007-04-06 10:27:44 +04:00
|
|
|
eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
|
2007-10-22 09:48:36 +04:00
|
|
|
eval=$(filter_skipped "$eval" "$skip") &&
|
2007-04-06 10:27:44 +04:00
|
|
|
eval "$eval" || exit
|
|
|
|
|
|
|
|
if [ -z "$bisect_rev" ]; then
|
|
|
|
echo "$bad was both good and bad"
|
|
|
|
exit 1
|
2005-08-30 22:04:39 +04:00
|
|
|
fi
|
2007-04-06 10:27:44 +04:00
|
|
|
if [ "$bisect_rev" = "$bad" ]; then
|
2007-10-22 09:48:36 +04:00
|
|
|
exit_if_skipped_commits "$bisect_tried"
|
2007-04-06 10:27:44 +04:00
|
|
|
echo "$bisect_rev is first bad commit"
|
2007-07-03 09:52:14 +04:00
|
|
|
git diff-tree --pretty $bisect_rev
|
2007-04-06 10:27:44 +04:00
|
|
|
exit 0
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
fi
|
2007-04-06 10:27:44 +04:00
|
|
|
|
2007-10-22 09:48:36 +04:00
|
|
|
# We should exit here only if the "bad"
|
|
|
|
# commit is also a "skip" commit (see above).
|
|
|
|
exit_if_skipped_commits "$bisect_rev"
|
|
|
|
|
2007-04-06 10:27:44 +04:00
|
|
|
echo "Bisecting: $bisect_nr revisions left to test after this"
|
|
|
|
echo "$bisect_rev" >"$GIT_DIR/refs/heads/new-bisect"
|
2007-02-02 08:47:34 +03:00
|
|
|
git checkout -q new-bisect || exit
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
mv "$GIT_DIR/refs/heads/new-bisect" "$GIT_DIR/refs/heads/bisect" &&
|
2007-07-03 09:52:14 +04:00
|
|
|
GIT_DIR="$GIT_DIR" git symbolic-ref HEAD refs/heads/bisect
|
|
|
|
git show-branch "$bisect_rev"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
}
|
|
|
|
|
2005-08-30 23:45:41 +04:00
|
|
|
bisect_visualize() {
|
|
|
|
bisect_next_check fail
|
2005-11-28 04:42:05 +03:00
|
|
|
not=`cd "$GIT_DIR/refs" && echo bisect/good-*`
|
|
|
|
eval gitk bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
|
2005-08-30 23:45:41 +04:00
|
|
|
}
|
|
|
|
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
bisect_reset() {
|
|
|
|
case "$#" in
|
2006-02-12 19:06:14 +03:00
|
|
|
0) if [ -s "$GIT_DIR/head-name" ]; then
|
|
|
|
branch=`cat "$GIT_DIR/head-name"`
|
|
|
|
else
|
|
|
|
branch=master
|
|
|
|
fi ;;
|
2007-10-24 09:01:13 +04:00
|
|
|
1) git show-ref --verify --quiet -- "refs/heads/$1" ||
|
|
|
|
die "$1 does not seem to be a valid branch"
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
branch="$1" ;;
|
2007-10-22 09:48:23 +04:00
|
|
|
*)
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
usage ;;
|
|
|
|
esac
|
2006-10-16 04:59:25 +04:00
|
|
|
if git checkout "$branch"; then
|
2007-04-04 09:12:02 +04:00
|
|
|
rm -f "$GIT_DIR/head-name"
|
|
|
|
bisect_clean_state
|
2006-10-16 04:59:25 +04:00
|
|
|
fi
|
2005-09-11 02:18:31 +04:00
|
|
|
}
|
|
|
|
|
2007-04-04 09:12:02 +04:00
|
|
|
bisect_clean_state() {
|
|
|
|
rm -fr "$GIT_DIR/refs/bisect"
|
|
|
|
rm -f "$GIT_DIR/refs/heads/bisect"
|
|
|
|
rm -f "$GIT_DIR/BISECT_LOG"
|
|
|
|
rm -f "$GIT_DIR/BISECT_NAMES"
|
|
|
|
rm -f "$GIT_DIR/BISECT_RUN"
|
|
|
|
}
|
|
|
|
|
2005-09-11 02:18:31 +04:00
|
|
|
bisect_replay () {
|
2007-10-24 09:01:13 +04:00
|
|
|
test -r "$1" || die "cannot read $1 for replaying"
|
2005-09-11 02:18:31 +04:00
|
|
|
bisect_reset
|
|
|
|
while read bisect command rev
|
|
|
|
do
|
|
|
|
test "$bisect" = "git-bisect" || continue
|
|
|
|
case "$command" in
|
|
|
|
start)
|
2005-11-28 04:42:05 +03:00
|
|
|
cmd="bisect_start $rev"
|
2007-10-24 09:01:13 +04:00
|
|
|
eval "$cmd" ;;
|
|
|
|
good|bad|skip)
|
|
|
|
bisect_write "$command" "$rev" ;;
|
2005-09-11 02:18:31 +04:00
|
|
|
*)
|
2007-10-24 09:01:13 +04:00
|
|
|
die "?? what are you talking about?" ;;
|
2005-09-11 02:18:31 +04:00
|
|
|
esac
|
|
|
|
done <"$1"
|
|
|
|
bisect_auto_next
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
}
|
|
|
|
|
2007-03-23 10:49:59 +03:00
|
|
|
bisect_run () {
|
2007-03-27 08:49:57 +04:00
|
|
|
bisect_next_check fail
|
|
|
|
|
2007-03-23 10:49:59 +03:00
|
|
|
while true
|
|
|
|
do
|
|
|
|
echo "running $@"
|
|
|
|
"$@"
|
|
|
|
res=$?
|
|
|
|
|
|
|
|
# Check for really bad run error.
|
|
|
|
if [ $res -lt 0 -o $res -ge 128 ]; then
|
|
|
|
echo >&2 "bisect run failed:"
|
|
|
|
echo >&2 "exit code $res from '$@' is < 0 or >= 128"
|
|
|
|
exit $res
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Use "bisect_good" or "bisect_bad"
|
|
|
|
# depending on run success or failure.
|
|
|
|
if [ $res -gt 0 ]; then
|
|
|
|
next_bisect='bisect_bad'
|
|
|
|
else
|
|
|
|
next_bisect='bisect_good'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# We have to use a subshell because bisect_good or
|
|
|
|
# bisect_bad functions can exit.
|
|
|
|
( $next_bisect > "$GIT_DIR/BISECT_RUN" )
|
|
|
|
res=$?
|
|
|
|
|
|
|
|
cat "$GIT_DIR/BISECT_RUN"
|
|
|
|
|
|
|
|
if [ $res -ne 0 ]; then
|
|
|
|
echo >&2 "bisect run failed:"
|
|
|
|
echo >&2 "$next_bisect exited with error code $res"
|
|
|
|
exit $res
|
|
|
|
fi
|
|
|
|
|
|
|
|
if grep "is first bad commit" "$GIT_DIR/BISECT_RUN" > /dev/null; then
|
|
|
|
echo "bisect run success"
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
case "$#" in
|
|
|
|
0)
|
|
|
|
usage ;;
|
|
|
|
*)
|
|
|
|
cmd="$1"
|
|
|
|
shift
|
|
|
|
case "$cmd" in
|
|
|
|
start)
|
|
|
|
bisect_start "$@" ;;
|
|
|
|
bad)
|
|
|
|
bisect_bad "$@" ;;
|
|
|
|
good)
|
|
|
|
bisect_good "$@" ;;
|
2007-10-22 09:48:36 +04:00
|
|
|
skip)
|
|
|
|
bisect_skip "$@" ;;
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
next)
|
|
|
|
# Not sure we want "next" at the UI level anymore.
|
|
|
|
bisect_next "$@" ;;
|
2005-08-30 23:45:41 +04:00
|
|
|
visualize)
|
|
|
|
bisect_visualize "$@" ;;
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
reset)
|
|
|
|
bisect_reset "$@" ;;
|
2005-09-11 02:18:31 +04:00
|
|
|
replay)
|
|
|
|
bisect_replay "$@" ;;
|
|
|
|
log)
|
|
|
|
cat "$GIT_DIR/BISECT_LOG" ;;
|
2007-03-23 10:49:59 +03:00
|
|
|
run)
|
|
|
|
bisect_run "$@" ;;
|
[PATCH] Making it easier to find which change introduced a bug
This adds a new "git bisect" command.
- "git bisect start"
start bisection search.
- "git bisect bad <rev>"
mark some version known-bad (if no arguments, then current HEAD)
- "git bisect good <revs>..."
mark some versions known-good (if no arguments, then current HEAD)
- "git bisect reset <branch>"
done with bisection search and go back to your work (if
no arguments, then "master").
The way you use it is:
git bisect start
git bisect bad # Current version is bad
git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
When you give at least one bad and one good versions, it will
bisect the revision tree and say something like:
Bisecting: 675 revisions left to test after this
and check out the state in the middle. Now, compile that kernel, and boot
it. Now, let's say that this booted kernel works fine, then just do
git bisect good # this one is good
which will now say
Bisecting: 337 revisions left to test after this
and you continue along, compiling that one, testing it, and depending on
whether it is good or bad, you say "git bisect good" or "git bisect bad",
and ask for the next bisection.
Until you have no more left, and you'll have been left with the first bad
kernel rev in "refs/bisect/bad".
Oh, and then after you want to reset to the original head, do a
git bisect reset
to get back to the master branch, instead of being in one of the bisection
branches ("git bisect start" will do that for you too, actually: it will
reset the bisection state, and before it does that it checks that you're
not using some old bisection branch).
Not really any harder than doing series of "quilt push" and "quilt pop",
now is it?
[jc: This patch is a rework based on what Linus posted to the
list. The changes are:
- The original introduced four separate commands, which was
three too many, so I merged them into one with subcommands.
- Since the next thing you would want to do after telling it
"bad" and "good" is always to bisect, this version does it
automatically for you.
- I think the termination condition was wrong. The original
version checked if the set of revisions reachable from next
bisection but not rechable from any of the known good ones
is empty, but if the current bisection was a bad one, this
would not terminate, so I changed it to terminate it when
the set becomes a singleton or empty.
- Removed the use of shell array variable.
]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-30 21:08:20 +04:00
|
|
|
*)
|
|
|
|
usage ;;
|
|
|
|
esac
|
|
|
|
esac
|