{"thread":{"id":"9885","subject":"[PATCH 3/3] rev-list --bisect: Bisection \"distance\" clean up.","startedAt":"2007-09-17T03:28:36Z","lastAt":"2007-09-17T03:28:36Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"53251","messageId":"20070917052836.d49c16d3.chriscool@tuxfamily.org","threadId":"9885","inReplyTo":null,"subject":"[PATCH 3/3] rev-list --bisect: Bisection \"distance\" clean up.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-09-17T03:28:36Z","receivedAt":"2007-09-17T03:28:36Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin-rev-list.c |   18 +++++++-----------\n 1 files changed, 7 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 8c9635a..899a31d 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -189,7 +189,7 @@ static int count_interesting_parents(struct commit *commit)\n \treturn count;\n }\n \n-static inline int halfway(struct commit_list *p, int distance, int nr)\n+static inline int halfway(struct commit_list *p, int nr)\n {\n \t/*\n \t * Don't short-cut something we are not going to return!\n@@ -202,8 +202,7 @@ static inline int halfway(struct commit_list *p, int distance, int nr)\n \t * 2 and 3 are halfway of 5.\n \t * 3 is halfway of 6 but 2 and 4 are not.\n \t */\n-\tdistance *= 2;\n-\tswitch (distance - nr) {\n+\tswitch (2 * weight(p) - nr) {\n \tcase -1: case 0: case 1:\n \t\treturn 1;\n \tdefault:\n@@ -295,7 +294,7 @@ static struct commit_list *best_bisection(struct commit_list *list, int nr)\n static struct commit_list *do_find_bisection(struct commit_list *list,\n \t\t\t\t\t     int nr, int *weights)\n {\n-\tint n, counted, distance;\n+\tint n, counted;\n \tstruct commit_list *p;\n \n \tcounted = 0;\n@@ -346,15 +345,13 @@ static struct commit_list *do_find_bisection(struct commit_list *list,\n \tfor (p = list; p; p = p->next) {\n \t\tif (p->item->object.flags & UNINTERESTING)\n \t\t\tcontinue;\n-\t\tn = weight(p);\n-\t\tif (n != -2)\n+\t\tif (weight(p) != -2)\n \t\t\tcontinue;\n-\t\tdistance = count_distance(p);\n+\t\tweight_set(p, count_distance(p));\n \t\tclear_distance(list);\n-\t\tweight_set(p, distance);\n \n \t\t/* Does it happen to be at exactly half-way? */\n-\t\tif (halfway(p, distance, nr))\n+\t\tif (halfway(p, nr))\n \t\t\treturn p;\n \t\tcounted++;\n \t}\n@@ -392,8 +389,7 @@ static struct commit_list *do_find_bisection(struct commit_list *list,\n \t\t\t\tweight_set(p, weight(q));\n \n \t\t\t/* Does it happen to be at exactly half-way? */\n-\t\t\tdistance = weight(p);\n-\t\t\tif (halfway(p, distance, nr))\n+\t\t\tif (halfway(p, nr))\n \t\t\t\treturn p;\n \t\t}\n \t}\n-- \n1.5.3.1.59.g93705\n"}]}