* Return true if the specified reference should be packed. */
| 1365 | * Return true if the specified reference should be packed. |
| 1366 | */ |
| 1367 | static int should_pack_ref(struct files_ref_store *refs, |
| 1368 | const struct reference *ref, |
| 1369 | struct refs_optimize_opts *opts) |
| 1370 | { |
| 1371 | struct string_list_item *item; |
| 1372 | |
| 1373 | /* Do not pack per-worktree refs: */ |
| 1374 | if (parse_worktree_ref(ref->name, NULL, NULL, NULL) != |
| 1375 | REF_WORKTREE_SHARED) |
| 1376 | return 0; |
| 1377 | |
| 1378 | /* Do not pack symbolic refs: */ |
| 1379 | if (ref->flags & REF_ISSYMREF) |
| 1380 | return 0; |
| 1381 | |
| 1382 | /* Do not pack broken refs: */ |
| 1383 | if (!ref_resolves_to_object(ref->name, refs->base.repo, ref->oid, ref->flags)) |
| 1384 | return 0; |
| 1385 | |
| 1386 | if (ref_excluded(opts->exclusions, ref->name)) |
| 1387 | return 0; |
| 1388 | |
| 1389 | for_each_string_list_item(item, opts->includes) |
| 1390 | if (!wildmatch(item->string, ref->name, 0)) |
| 1391 | return 1; |
| 1392 | |
| 1393 | return 0; |
| 1394 | } |
| 1395 | |
| 1396 | static int should_pack_refs(struct files_ref_store *refs, |
| 1397 | struct refs_optimize_opts *opts) |
no test coverage detected