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

Function is_dup_ref

refs/ref-cache.c:202–218  ·  view source on GitHub ↗

* Emit a warning and return true iff ref1 and ref2 have the same name * and the same oid. Die if they have the same name but different * oids. */

Source from the content-addressed store, hash-verified

200 * oids.
201 */
202static int is_dup_ref(const struct ref_entry *ref1, const struct ref_entry *ref2)
203{
204 if (strcmp(ref1->name, ref2->name))
205 return 0;
206
207 /* Duplicate name; make sure that they don't conflict: */
208
209 if ((ref1->flag & REF_DIR) || (ref2->flag & REF_DIR))
210 /* This is impossible by construction */
211 die("Reference directory conflict: %s", ref1->name);
212
213 if (!oideq(&ref1->u.value.oid, &ref2->u.value.oid))
214 die("Duplicated ref, and SHA1s don't match: %s", ref1->name);
215
216 warning("Duplicated ref: %s", ref1->name);
217 return 1;
218}
219
220/*
221 * Sort the entries in dir non-recursively (if they are not already

Callers 1

sort_ref_dirFunction · 0.85

Calls 3

oideqFunction · 0.85
warningFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected