提交 6dc6ba70 编写于 作者: M Michael Haggerty 提交者: Junio C Hamano

packed_peel_ref(): new function, extracted from `files_peel_ref()`

This will later become a method of `packed_ref_store`.
Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 0f199b1e
......@@ -1013,6 +1013,18 @@ static int lock_raw_ref(struct files_ref_store *refs,
return ret;
}
static int packed_peel_ref(struct packed_ref_store *refs,
const char *refname, unsigned char *sha1)
{
struct ref_entry *r = get_packed_ref(refs, refname);
if (!r || peel_entry(r, 0))
return -1;
hashcpy(sha1, r->u.value.peeled.hash);
return 0;
}
static int files_peel_ref(struct ref_store *ref_store,
const char *refname, unsigned char *sha1)
{
......@@ -1043,17 +1055,9 @@ static int files_peel_ref(struct ref_store *ref_store,
* be expensive and (b) loose references anyway usually do not
* have REF_KNOWS_PEELED.
*/
if (flag & REF_ISPACKED) {
struct ref_entry *r =
get_packed_ref(refs->packed_ref_store, refname);
if (r) {
if (peel_entry(r, 0))
return -1;
hashcpy(sha1, r->u.value.peeled.hash);
return 0;
}
}
if (flag & REF_ISPACKED &&
!packed_peel_ref(refs->packed_ref_store, refname, sha1))
return 0;
return peel_object(base, sha1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册