aboutsummaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-04-12 16:46:40 -0700
committerJunio C Hamano <gitster@pobox.com>2009-04-12 16:46:40 -0700
commit6e353a5e5de9da021c7c6c0bc2dc5f95a39900a1 (patch)
treead981695b0376a42123220d98f3cc4cc74c2ca4b /git-bisect.sh
parenta54c4edc511608fdba513cc94812c31fd4b497f6 (diff)
parent13858e5770dd218e5318819d3273c916b46cf8e5 (diff)
downloadgit-6e353a5e5de9da021c7c6c0bc2dc5f95a39900a1.tar.gz
git-6e353a5e5de9da021c7c6c0bc2dc5f95a39900a1.tar.xz
Merge branch 'cc/bisect-filter'
* cc/bisect-filter: (21 commits) rev-list: add "int bisect_show_flags" in "struct rev_list_info" rev-list: remove last static vars used in "show_commit" list-objects: add "void *data" parameter to show functions bisect--helper: string output variables together with "&&" rev-list: pass "int flags" as last argument of "show_bisect_vars" t6030: test bisecting with paths bisect: use "bisect--helper" and remove "filter_skipped" function bisect: implement "read_bisect_paths" to read paths in "$GIT_DIR/BISECT_NAMES" bisect--helper: implement "git bisect--helper" bisect: use the new generic "sha1_pos" function to lookup sha1 rev-list: call new "filter_skip" function patch-ids: use the new generic "sha1_pos" function to lookup sha1 sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1 rev-list: pass "revs" to "show_bisect_vars" rev-list: make "show_bisect_vars" non static rev-list: move code to show bisect vars into its own function rev-list: move bisect related code into its own file rev-list: make "bisect_list" variable local to "cmd_rev_list" refs: add "for_each_ref_in" function to refactor "for_each_*_ref" functions quote: add "sq_dequote_to_argv" to put unwrapped args in an argv array ...
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh94
1 files changed, 8 insertions, 86 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index df0ae63b4..24712ff30 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -279,87 +279,14 @@ bisect_auto_next() {
bisect_next_check && bisect_next || :
}
-filter_skipped() {
- _eval="$1"
- _skip="$2"
-
- if [ -z "$_skip" ]; then
- eval "$_eval" | {
- while read line
- do
- echo "$line &&"
- done
- echo ':'
- }
- return
- fi
-
- # Let's parse the output of:
- # "git rev-list --bisect-vars --bisect-all ..."
- eval "$_eval" | {
- VARS= FOUND= TRIED=
- while read hash line
- do
- case "$VARS,$FOUND,$TRIED,$hash" in
- 1,*,*,*)
- # "bisect_foo=bar" read from rev-list output.
- echo "$hash &&"
- ;;
- ,*,*,---*)
- # Separator
- ;;
- ,,,bisect_rev*)
- # We had nothing to search.
- echo "bisect_rev= &&"
- VARS=1
- ;;
- ,,*,bisect_rev*)
- # We did not find a good bisect rev.
- # This should happen only if the "bad"
- # commit is also a "skip" commit.
- 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
- ;;
- ,1,*,bisect_rev*)
- # We have already found a rev to be tested.
- VARS=1
- ;;
- ,1,*,*)
- ;;
- *)
- # Unexpected input
- echo "die 'filter_skipped error'"
- die "filter_skipped error " \
- "VARS: '$VARS' " \
- "FOUND: '$FOUND' " \
- "TRIED: '$TRIED' " \
- "hash: '$hash' " \
- "line: '$line'"
- ;;
- esac
- done
- echo ':'
- }
-}
-
exit_if_skipped_commits () {
_tried=$1
- if expr "$_tried" : ".*[|].*" > /dev/null ; then
+ _bad=$2
+ if test -n "$_tried" ; then
echo "There are only 'skip'ped commit left to test."
echo "The first bad commit could be any of:"
echo "$_tried" | tr '[|]' '[\012]'
+ test -n "$_bad" && echo "$_bad"
echo "We cannot bisect more!"
exit 2
fi
@@ -490,28 +417,23 @@ bisect_next() {
test "$?" -eq "1" && return
# Get bisection information
- BISECT_OPT=''
- test -n "$skip" && BISECT_OPT='--bisect-all'
- eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" &&
- eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
- eval=$(filter_skipped "$eval" "$skip") &&
+ eval=$(eval "git bisect--helper --next-vars") &&
eval "$eval" || exit
if [ -z "$bisect_rev" ]; then
+ # We should exit here only if the "bad"
+ # commit is also a "skip" commit (see above).
+ exit_if_skipped_commits "$bisect_tried"
echo "$bad was both good and bad"
exit 1
fi
if [ "$bisect_rev" = "$bad" ]; then
- exit_if_skipped_commits "$bisect_tried"
+ exit_if_skipped_commits "$bisect_tried" "$bad"
echo "$bisect_rev is first bad commit"
git diff-tree --pretty $bisect_rev
exit 0
fi
- # We should exit here only if the "bad"
- # commit is also a "skip" commit (see above).
- exit_if_skipped_commits "$bisect_rev"
-
bisect_checkout "$bisect_rev" "$bisect_nr revisions left to test after this (roughly $bisect_steps steps)"
}