From 4417df8c492489613d031478ba2e3604f65a5f84 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sat, 6 May 2017 22:10:24 +0000 Subject: refs/files-backend: convert many internals to struct object_id Convert many of the internals of the files backend to use struct object_id. Avoid converting public APIs (except one change to refs/ref-cache.c) to limit the scope of the changes. Convert one use of get_sha1_hex to parse_oid_hex, and rely on the fact that a strbuf will be NUL-terminated and that parse_oid_hex will fail on truncated input to avoid the need to check the length. This is a requirement to convert parse_object later on. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- refs/ref-cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'refs/ref-cache.c') diff --git a/refs/ref-cache.c b/refs/ref-cache.c index 6059362f1d..6b11d9cd12 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -32,7 +32,7 @@ struct ref_dir *get_ref_dir(struct ref_entry *entry) } struct ref_entry *create_ref_entry(const char *refname, - const unsigned char *sha1, int flag, + const struct object_id *oid, int flag, int check_name) { struct ref_entry *ref; @@ -41,7 +41,7 @@ struct ref_entry *create_ref_entry(const char *refname, check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) die("Reference has invalid format: '%s'", refname); FLEX_ALLOC_STR(ref, name, refname); - hashcpy(ref->u.value.oid.hash, sha1); + oidcpy(&ref->u.value.oid, oid); oidclr(&ref->u.value.peeled); ref->flag = flag; return ref; -- cgit v1.2.3