Further correction to tree entry sorting (for git fsck)

This commit is contained in:
John Wiegley 2011-02-07 00:11:00 -05:00
parent fb8dd803b7
commit 5bf4291637

View File

@ -50,10 +50,10 @@ static int cache_name_compare(const char *name1, int len1, int isdir1,
if (cmp) if (cmp)
return cmp; return cmp;
if (len1 < len2) if (len1 < len2)
return ((isdir1 == isdir2) ? -1 : return ((!isdir1 && !isdir2) ? -1 :
(isdir1 ? '/' - name2[len1] : name2[len1] - '/')); (isdir1 ? '/' - name2[len1] : name2[len1] - '/'));
if (len1 > len2) if (len1 > len2)
return ((isdir1 == isdir2) ? 1 : return ((!isdir1 && !isdir2) ? 1 :
(isdir2 ? name1[len2] - '/' : '/' - name1[len2])); (isdir2 ? name1[len2] - '/' : '/' - name1[len2]));
return 0; return 0;
} }