diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-02-03 15:04:49 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-03 15:04:49 -0800 |
commit | 973e20b83f38d0a640d4e0478ddbd50dfa98daf1 (patch) | |
tree | 6cf89c7e061f25e00153b64af2dc1736c98337f9 /refs.c | |
parent | 6cd7f9dc297d096e5b7787db8d0ad8ca05a1b296 (diff) | |
parent | 36a317929b8f0c67d77d54235f2d20751c576cbb (diff) | |
download | git-973e20b83f38d0a640d4e0478ddbd50dfa98daf1.tar.gz |
Merge branch 'jk/peel-iterated-oid'
The peel_ref() API has been replaced with peel_iterated_oid().
* jk/peel-iterated-oid:
refs: switch peel_ref() to peel_iterated_oid()
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 29 |
1 files changed, 6 insertions, 23 deletions
@@ -1916,31 +1916,14 @@ int refs_pack_refs(struct ref_store *refs, unsigned int flags) return refs->be->pack_refs(refs, flags); } -int refs_peel_ref(struct ref_store *refs, const char *refname, - struct object_id *oid) +int peel_iterated_oid(const struct object_id *base, struct object_id *peeled) { - int flag; - struct object_id base; - - if (current_ref_iter && current_ref_iter->refname == refname) { - struct object_id peeled; - - if (ref_iterator_peel(current_ref_iter, &peeled)) - return -1; - oidcpy(oid, &peeled); - return 0; - } + if (current_ref_iter && + (current_ref_iter->oid == base || + oideq(current_ref_iter->oid, base))) + return ref_iterator_peel(current_ref_iter, peeled); - if (refs_read_ref_full(refs, refname, - RESOLVE_REF_READING, &base, &flag)) - return -1; - - return peel_object(&base, oid); -} - -int peel_ref(const char *refname, struct object_id *oid) -{ - return refs_peel_ref(get_main_ref_store(the_repository), refname, oid); + return peel_object(base, peeled); } int refs_create_symref(struct ref_store *refs, |