MCPcopy Create free account
hub / github.com/git/git / migrate_one_ref

Function migrate_one_ref

refs.c:3181–3209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3179};
3180
3181static 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
3206done:
3207 strbuf_release(&symref_target);
3208 return ret;
3209}
3210
3211static int migrate_one_reflog_entry(const char *refname,
3212 struct object_id *old_oid,

Callers

nothing calls this directly

Calls 5

refs_read_symbolic_refFunction · 0.85
ref_transaction_updateFunction · 0.85
null_oidFunction · 0.85
ref_transaction_createFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected