* 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. */
| 200 | * oids. |
| 201 | */ |
| 202 | static 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 |
no test coverage detected