| 1097 | } |
| 1098 | |
| 1099 | static int already_written(struct odb_transaction_files *transaction, |
| 1100 | struct object_id *oid) |
| 1101 | { |
| 1102 | /* The object may already exist in the repository */ |
| 1103 | if (odb_has_object(transaction->base.source->odb, oid, |
| 1104 | ODB_HAS_OBJECT_RECHECK_PACKED | ODB_HAS_OBJECT_FETCH_PROMISOR)) |
| 1105 | return 1; |
| 1106 | |
| 1107 | /* Might want to keep the list sorted */ |
| 1108 | for (uint32_t i = 0; i < transaction->packfile.nr_written; i++) |
| 1109 | if (oideq(&transaction->packfile.written[i]->oid, oid)) |
| 1110 | return 1; |
| 1111 | |
| 1112 | /* This is a new object we need to keep */ |
| 1113 | return 0; |
| 1114 | } |
| 1115 | |
| 1116 | /* Lazily create backing packfile for the state */ |
| 1117 | static void prepare_packfile_transaction(struct odb_transaction_files *transaction) |
no test coverage detected