From cca5fa6406046c19ab5a8117fe71bf4402c00d88 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sun, 15 Oct 2017 22:06:57 +0000 Subject: refs: convert dwim_ref and expand_ref to struct object_id All of the callers of these functions just pass the hash member of a struct object_id, so convert them to use a pointer to struct object_id directly. Insert a check for NULL in expand_ref on a temporary basis; this check can be removed when resolve_ref_unsafe is converted as well. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- sha1_name.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sha1_name.c') diff --git a/sha1_name.c b/sha1_name.c index c7c5ab376..d8ff83175 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -603,7 +603,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, if (len == GIT_SHA1_HEXSZ && !get_oid_hex(str, oid)) { if (warn_ambiguous_refs && warn_on_object_refname_ambiguity) { - refs_found = dwim_ref(str, len, tmp_oid.hash, &real_ref); + refs_found = dwim_ref(str, len, &tmp_oid, &real_ref); if (refs_found > 0) { warning(warn_msg, len, str); if (advice_object_name_warning) @@ -654,11 +654,11 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, if (!len && reflog_len) /* allow "@{...}" to mean the current branch reflog */ - refs_found = dwim_ref("HEAD", 4, oid->hash, &real_ref); + refs_found = dwim_ref("HEAD", 4, oid, &real_ref); else if (reflog_len) refs_found = dwim_log(str, len, oid->hash, &real_ref); else - refs_found = dwim_ref(str, len, oid->hash, &real_ref); + refs_found = dwim_ref(str, len, oid, &real_ref); if (!refs_found) return -1; -- cgit v1.2.1 From 334dc52f49ee3e56a32142d3500fe93ef79aac67 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sun, 15 Oct 2017 22:06:59 +0000 Subject: refs: convert dwim_log to struct object_id Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- sha1_name.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sha1_name.c') diff --git a/sha1_name.c b/sha1_name.c index d8ff83175..514915460 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -656,7 +656,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, /* allow "@{...}" to mean the current branch reflog */ refs_found = dwim_ref("HEAD", 4, oid, &real_ref); else if (reflog_len) - refs_found = dwim_log(str, len, oid->hash, &real_ref); + refs_found = dwim_log(str, len, oid, &real_ref); else refs_found = dwim_ref(str, len, oid, &real_ref); -- cgit v1.2.1 From 8eb36d9422a04a30ecc54fd69b4f836eafd10637 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sun, 15 Oct 2017 22:07:03 +0000 Subject: refs: convert read_ref_at to struct object_id Convert the callers and internals, including struct read_ref_at_cb, of read_ref_at to use struct object_id. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- sha1_name.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sha1_name.c') diff --git a/sha1_name.c b/sha1_name.c index 514915460..8d903a74d 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -697,7 +697,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, return -1; } } - if (read_ref_at(real_ref, flags, at_time, nth, oid->hash, NULL, + if (read_ref_at(real_ref, flags, at_time, nth, oid, NULL, &co_time, &co_tz, &co_cnt)) { if (!len) { if (starts_with(real_ref, "refs/heads/")) { -- cgit v1.2.1