| 3179 | }; |
| 3180 | |
| 3181 | static int migrate_one_ref(const struct reference *ref, void *cb_data) |
| 3182 | { |
| 3183 | struct migration_data *data = cb_data; |
| 3184 | const struct git_hash_algo *hash_algo = data->transaction->ref_store->repo->hash_algo; |
| 3185 | struct strbuf symref_target = STRBUF_INIT; |
| 3186 | int ret; |
| 3187 | |
| 3188 | if (ref->flags & REF_ISSYMREF) { |
| 3189 | ret = refs_read_symbolic_ref(data->old_refs, ref->name, &symref_target); |
| 3190 | if (ret < 0) |
| 3191 | goto done; |
| 3192 | |
| 3193 | ret = ref_transaction_update(data->transaction, ref->name, NULL, null_oid(hash_algo), |
| 3194 | symref_target.buf, NULL, |
| 3195 | REF_SKIP_CREATE_REFLOG | REF_NO_DEREF, NULL, data->errbuf); |
| 3196 | if (ret < 0) |
| 3197 | goto done; |
| 3198 | } else { |
| 3199 | ret = ref_transaction_create(data->transaction, ref->name, ref->oid, NULL, |
| 3200 | REF_SKIP_CREATE_REFLOG | REF_SKIP_OID_VERIFICATION, |
| 3201 | NULL, data->errbuf); |
| 3202 | if (ret < 0) |
| 3203 | goto done; |
| 3204 | } |
| 3205 | |
| 3206 | done: |
| 3207 | strbuf_release(&symref_target); |
| 3208 | return ret; |
| 3209 | } |
| 3210 | |
| 3211 | static int migrate_one_reflog_entry(const char *refname, |
| 3212 | struct object_id *old_oid, |
nothing calls this directly
no test coverage detected