summaryrefslogtreecommitdiff
path: root/rev-list.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2005-11-27 19:32:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-29 07:11:38 (GMT)
commitb3cfd939c330211c9812f814094aa1dbe9531bdc (patch)
treeafa5d0e13f83afecf3b0810eba29eaf3ad3e531e /rev-list.c
parent9ef2b3cbf62d15aa0312bde349347873d7c0f399 (diff)
downloadgit-b3cfd939c330211c9812f814094aa1dbe9531bdc.zip
git-b3cfd939c330211c9812f814094aa1dbe9531bdc.tar.gz
git-b3cfd939c330211c9812f814094aa1dbe9531bdc.tar.bz2
bisect: limit the searchspace by pathspecs
It was surprisingly easy to do. git bisect start <pathspec> followed by all the normal "git bisect good/bad" stuff. Almost totally untested, and I guarantee that if your pathnames have spaces in them (or your GIT_DIR has spaces in it) this won't work. I don't know how to fix that, my shell programming isn't good enough. This involves small changes to make "git-rev-list --bisect" work in the presense of a pathspec limiter, and then truly trivial (and that's the broken part) changes to make "git bisect" save away and use the pathspec. I tried one bisection, and a "git bisect visualize", and it all looked correct. But hey, don't be surprised if it has problems. Linus Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'rev-list.c')
-rw-r--r--rev-list.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/rev-list.c b/rev-list.c
index e17f928..8020d97 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -350,7 +350,8 @@ static int count_distance(struct commit_list *entry)
if (commit->object.flags & (UNINTERESTING | COUNTED))
break;
- nr++;
+ if (!paths || (commit->object.flags & TREECHANGE))
+ nr++;
commit->object.flags |= COUNTED;
p = commit->parents;
entry = p;
@@ -362,6 +363,7 @@ static int count_distance(struct commit_list *entry)
}
}
}
+
return nr;
}
@@ -382,15 +384,20 @@ static struct commit_list *find_bisection(struct commit_list *list)
nr = 0;
p = list;
while (p) {
- nr++;
+ if (!paths || (p->item->object.flags & TREECHANGE))
+ nr++;
p = p->next;
}
closest = 0;
best = list;
- p = list;
- while (p) {
- int distance = count_distance(p);
+ for (p = list; p; p = p->next) {
+ int distance;
+
+ if (paths && !(p->item->object.flags & TREECHANGE))
+ continue;
+
+ distance = count_distance(p);
clear_distance(list);
if (nr - distance < distance)
distance = nr - distance;
@@ -398,7 +405,6 @@ static struct commit_list *find_bisection(struct commit_list *list)
best = p;
closest = distance;
}
- p = p->next;
}
if (best)
best->next = NULL;