MCPcopy Index your code
hub / github.com/git/git / tree_entry_pathcmp

Function tree_entry_pathcmp

tree-diff.c:139–155  ·  view source on GitHub ↗

* Compare two tree entries, taking into account only path/S_ISDIR(mode), * but not their sha1's. * * NOTE files and directories *always* compare differently, even when having * the same name - thanks to base_name_compare(). * * NOTE empty (=invalid) descriptor(s) take part in comparison as +infty, * so that they sort *after* valid tree entries. * * Due to this convention, i

Source from the content-addressed store, hash-verified

137 * non-empty descriptors will be processed first.
138 */
139static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_desc *t2)
140{
141 struct name_entry *e1, *e2;
142 int cmp;
143
144 /* empty descriptors sort after valid tree entries */
145 if (!t1->size)
146 return t2->size ? 1 : 0;
147 else if (!t2->size)
148 return -1;
149
150 e1 = &t1->entry;
151 e2 = &t2->entry;
152 cmp = base_name_compare(e1->path, tree_entry_len(e1), e1->mode,
153 e2->path, tree_entry_len(e2), e2->mode);
154 return cmp;
155}
156
157
158/*

Callers 1

ll_diff_tree_pathsFunction · 0.85

Calls 2

base_name_compareFunction · 0.85
tree_entry_lenFunction · 0.85

Tested by

no test coverage detected