зеркало из https://github.com/microsoft/git.git
packed_peel_ref(): new function, extracted from `files_peel_ref()`
This will later become a method of `packed_ref_store`. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
0f199b1ee0
Коммит
6dc6ba7092
|
@ -1013,6 +1013,18 @@ out:
|
|||
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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче