| 2496 | } |
| 2497 | |
| 2498 | static void update_shallow_info(struct command *commands, |
| 2499 | struct shallow_info *si, |
| 2500 | struct oid_array *ref) |
| 2501 | { |
| 2502 | struct command *cmd; |
| 2503 | int *ref_status; |
| 2504 | remove_nonexistent_theirs_shallow(si); |
| 2505 | if (!si->nr_ours && !si->nr_theirs) { |
| 2506 | shallow_update = 0; |
| 2507 | return; |
| 2508 | } |
| 2509 | |
| 2510 | for (cmd = commands; cmd; cmd = cmd->next) { |
| 2511 | if (is_null_oid(&cmd->new_oid)) |
| 2512 | continue; |
| 2513 | oid_array_append(ref, &cmd->new_oid); |
| 2514 | cmd->index = ref->nr - 1; |
| 2515 | } |
| 2516 | si->ref = ref; |
| 2517 | |
| 2518 | if (shallow_update) { |
| 2519 | prepare_shallow_update(si); |
| 2520 | return; |
| 2521 | } |
| 2522 | |
| 2523 | ALLOC_ARRAY(ref_status, ref->nr); |
| 2524 | assign_shallow_commits_to_refs(si, NULL, ref_status); |
| 2525 | for (cmd = commands; cmd; cmd = cmd->next) { |
| 2526 | if (is_null_oid(&cmd->new_oid)) |
| 2527 | continue; |
| 2528 | if (ref_status[cmd->index]) { |
| 2529 | cmd->error_string = "shallow update not allowed"; |
| 2530 | cmd->skip_update = 1; |
| 2531 | } |
| 2532 | } |
| 2533 | free(ref_status); |
| 2534 | } |
| 2535 | |
| 2536 | static void report(struct command *commands, const char *unpack_status) |
| 2537 | { |
no test coverage detected