refs: convert read_raw_ref backends to struct object_id
Convert the unsigned char * parameter to struct object_id * for files_read_raw_ref and packed_read_raw_ref. Update the documentation. Switch from using get_sha1_hex and a hard-coded 40 to using parse_oid_hex. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
ac2ed0d7d5
commit
99afe91a6c
8
refs.c
8
refs.c
@ -1382,10 +1382,10 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
|
||||
}
|
||||
|
||||
int refs_read_raw_ref(struct ref_store *ref_store,
|
||||
const char *refname, unsigned char *sha1,
|
||||
const char *refname, struct object_id *oid,
|
||||
struct strbuf *referent, unsigned int *type)
|
||||
{
|
||||
return ref_store->be->read_raw_ref(ref_store, refname, sha1, referent, type);
|
||||
return ref_store->be->read_raw_ref(ref_store, refname, oid, referent, type);
|
||||
}
|
||||
|
||||
/* This function needs to return a meaningful errno on failure */
|
||||
@ -1428,7 +1428,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
|
||||
unsigned int read_flags = 0;
|
||||
|
||||
if (refs_read_raw_ref(refs, refname,
|
||||
oid->hash, &sb_refname, &read_flags)) {
|
||||
oid, &sb_refname, &read_flags)) {
|
||||
*flags |= read_flags;
|
||||
|
||||
/* In reading mode, refs must eventually resolve */
|
||||
@ -1879,7 +1879,7 @@ int refs_verify_refname_available(struct ref_store *refs,
|
||||
if (skip && string_list_has_string(skip, dirname.buf))
|
||||
continue;
|
||||
|
||||
if (!refs_read_raw_ref(refs, dirname.buf, oid.hash, &referent, &type)) {
|
||||
if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent, &type)) {
|
||||
strbuf_addf(err, "'%s' exists; cannot create '%s'",
|
||||
dirname.buf, refname);
|
||||
goto cleanup;
|
||||
|
||||
Reference in New Issue
Block a user