Commit 181bbf1498e3554cc66d1f00619ee4e9da695a95

Vicent Martí 2012-03-28T19:12:13

tree: Fix homing entry search

diff --git a/src/tree.c b/src/tree.c
index 19681e3..8a0971a 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -97,7 +97,7 @@ static int tree_key_search(git_vector *entries, const char *filename)
 	for (i = homing; i < (int)entries->length; ++i) {
 		entry = entries->contents[i];
 
-		if (homing_search_cmp(&ksearch, entry) != 0)
+		if (homing_search_cmp(&ksearch, entry) < 0)
 			break;
 
 		if (strcmp(filename, entry->filename) == 0)
@@ -109,7 +109,7 @@ static int tree_key_search(git_vector *entries, const char *filename)
 	for (i = homing - 1; i >= 0; --i) {
 		entry = entries->contents[i];
 
-		if (homing_search_cmp(&ksearch, entry) != 0)
+		if (homing_search_cmp(&ksearch, entry) > 0)
 			break;
 
 		if (strcmp(filename, entry->filename) == 0)