summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-02-07 00:11:00 -0500
committerJohn Wiegley <johnw@newartisans.com>2011-02-07 00:11:00 -0500
commit5bf42916378b49f2790b4da91cb056cd9e08f686 (patch)
tree41984062751dafb44874508fd0a6497f1aa8e65a /src/tree.c
parentfb8dd803b76020cc42103b506aed4c975ca047bd (diff)
downloadlibgit2-5bf42916378b49f2790b4da91cb056cd9e08f686.tar.gz
Further correction to tree entry sorting (for git fsck)
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tree.c b/src/tree.c
index d71cd37d4..bf1cdfa0f 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -50,10 +50,10 @@ static int cache_name_compare(const char *name1, int len1, int isdir1,
if (cmp)
return cmp;
if (len1 < len2)
- return ((isdir1 == isdir2) ? -1 :
+ return ((!isdir1 && !isdir2) ? -1 :
(isdir1 ? '/' - name2[len1] : name2[len1] - '/'));
if (len1 > len2)
- return ((isdir1 == isdir2) ? 1 :
+ return ((!isdir1 && !isdir2) ? 1 :
(isdir2 ? name1[len2] - '/' : '/' - name1[len2]));
return 0;
}