MCPcopy Create free account
hub / github.com/git/git / base_name_compare

Function base_name_compare

tree.c:99–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99int base_name_compare(const char *name1, size_t len1, int mode1,
100 const char *name2, size_t len2, int mode2)
101{
102 unsigned char c1, c2;
103 size_t len = len1 < len2 ? len1 : len2;
104 int cmp;
105
106 cmp = memcmp(name1, name2, len);
107 if (cmp)
108 return cmp;
109 c1 = name1[len];
110 c2 = name2[len];
111 if (!c1 && S_ISDIR(mode1))
112 c1 = '/';
113 if (!c2 && S_ISDIR(mode2))
114 c2 = '/';
115 return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
116}
117
118/*
119 * df_name_compare() is identical to base_name_compare(), except it

Callers 7

tree_entry_orderFunction · 0.85
tree_entry_pathcmpFunction · 0.85
compare_pathsFunction · 0.85
ent_compareFunction · 0.85
tecmp0Function · 0.85
tecmp1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected