| 265 | } |
| 266 | |
| 267 | static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs, |
| 268 | const char *refname, |
| 269 | struct ref_dir *dir) |
| 270 | { |
| 271 | struct object_id oid; |
| 272 | int flag; |
| 273 | const char *referent = refs_resolve_ref_unsafe(&refs->base, |
| 274 | refname, |
| 275 | RESOLVE_REF_READING, |
| 276 | &oid, &flag); |
| 277 | |
| 278 | if (!referent) { |
| 279 | oidclr(&oid, refs->base.repo->hash_algo); |
| 280 | flag |= REF_ISBROKEN; |
| 281 | } else if (is_null_oid(&oid)) { |
| 282 | /* |
| 283 | * It is so astronomically unlikely |
| 284 | * that null_oid is the OID of an |
| 285 | * actual object that we consider its |
| 286 | * appearance in a loose reference |
| 287 | * file to be repo corruption |
| 288 | * (probably due to a software bug). |
| 289 | */ |
| 290 | flag |= REF_ISBROKEN; |
| 291 | } |
| 292 | |
| 293 | if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) { |
| 294 | if (!refname_is_safe(refname)) |
| 295 | die("loose refname is dangerous: %s", refname); |
| 296 | oidclr(&oid, refs->base.repo->hash_algo); |
| 297 | flag |= REF_BAD_NAME | REF_ISBROKEN; |
| 298 | } |
| 299 | |
| 300 | if (!(flag & REF_ISSYMREF)) |
| 301 | referent = NULL; |
| 302 | |
| 303 | add_entry_to_dir(dir, create_ref_entry(refname, referent, &oid, flag)); |
| 304 | } |
| 305 | |
| 306 | /* |
| 307 | * Read the loose references from the namespace dirname into dir |
no test coverage detected