refs: convert resolve_ref_unsafe to struct object_id
Convert resolve_ref_unsafe to take a pointer to struct object_id by converting one remaining caller to use struct object_id, removing the temporary NULL pointer check in expand_ref, converting the declaration and definition, and applying the following semantic patch: @@ expression E1, E2, E3, E4; @@ - resolve_ref_unsafe(E1, E2, E3.hash, E4) + resolve_ref_unsafe(E1, E2, &E3, E4) @@ expression E1, E2, E3, E4; @@ - resolve_ref_unsafe(E1, E2, E3->hash, E4) + resolve_ref_unsafe(E1, E2, E3, E4) 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
0f05154c70
commit
49e61479be
@ -189,7 +189,7 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
|
||||
if (!refs_resolve_ref_unsafe(&refs->base,
|
||||
refname.buf,
|
||||
RESOLVE_REF_READING,
|
||||
oid.hash, &flag)) {
|
||||
&oid, &flag)) {
|
||||
oidclr(&oid);
|
||||
flag |= REF_ISBROKEN;
|
||||
} else if (is_null_oid(&oid)) {
|
||||
@ -855,7 +855,7 @@ static struct ref_lock *lock_ref_sha1_basic(struct files_ref_store *refs,
|
||||
files_ref_path(refs, &ref_file, refname);
|
||||
resolved = !!refs_resolve_ref_unsafe(&refs->base,
|
||||
refname, resolve_flags,
|
||||
lock->old_oid.hash, type);
|
||||
&lock->old_oid, type);
|
||||
if (!resolved && errno == EISDIR) {
|
||||
/*
|
||||
* we are trying to lock foo but we used to
|
||||
@ -874,7 +874,7 @@ static struct ref_lock *lock_ref_sha1_basic(struct files_ref_store *refs,
|
||||
}
|
||||
resolved = !!refs_resolve_ref_unsafe(&refs->base,
|
||||
refname, resolve_flags,
|
||||
lock->old_oid.hash, type);
|
||||
&lock->old_oid, type);
|
||||
}
|
||||
if (!resolved) {
|
||||
last_errno = errno;
|
||||
@ -1251,7 +1251,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
|
||||
|
||||
if (!refs_resolve_ref_unsafe(&refs->base, oldrefname,
|
||||
RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
|
||||
orig_oid.hash, &flag)) {
|
||||
&orig_oid, &flag)) {
|
||||
ret = error("refname %s not found", oldrefname);
|
||||
goto out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user