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 --- builtin/fast-export.c | 2 +- builtin/log.c | 2 +- builtin/merge-base.c | 2 +- builtin/merge.c | 2 +- builtin/rev-parse.c | 2 +- builtin/show-branch.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'builtin') diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 2fb60d6d48..d74c73f777 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -823,7 +823,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) if (e->flags & UNINTERESTING) continue; - if (dwim_ref(e->name, strlen(e->name), oid.hash, &full_name) != 1) + if (dwim_ref(e->name, strlen(e->name), &oid, &full_name) != 1) continue; if (refspecs) { diff --git a/builtin/log.c b/builtin/log.c index d81a09051e..ba9d4cd786 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -975,7 +975,7 @@ static char *find_branch_name(struct rev_info *rev) return NULL; ref = rev->cmdline.rev[positive].name; tip_oid = &rev->cmdline.rev[positive].item->oid; - if (dwim_ref(ref, strlen(ref), branch_oid.hash, &full_ref) && + if (dwim_ref(ref, strlen(ref), &branch_oid, &full_ref) && skip_prefix(full_ref, "refs/heads/", &v) && !oidcmp(tip_oid, &branch_oid)) branch = xstrdup(v); diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 6dbd167d3b..e99f5405ce 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -156,7 +156,7 @@ static int handle_fork_point(int argc, const char **argv) struct commit_list *bases; int i, ret = 0; - switch (dwim_ref(argv[0], strlen(argv[0]), oid.hash, &refname)) { + switch (dwim_ref(argv[0], strlen(argv[0]), &oid, &refname)) { case 0: die("No such ref: '%s'", argv[0]); case 1: diff --git a/builtin/merge.c b/builtin/merge.c index 99d2df965f..6071dbfe34 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -454,7 +454,7 @@ static void merge_name(const char *remote, struct strbuf *msg) if (!remote_head) die(_("'%s' does not point to a commit"), remote); - if (dwim_ref(remote, strlen(remote), branch_head.hash, &found_ref) > 0) { + if (dwim_ref(remote, strlen(remote), &branch_head, &found_ref) > 0) { if (starts_with(found_ref, "refs/heads/")) { strbuf_addf(msg, "%s\t\tbranch '%s' of .\n", oid_to_hex(&branch_head), remote); diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index a8d7e6f7ae..74aa644cbb 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -133,7 +133,7 @@ static void show_rev(int type, const struct object_id *oid, const char *name) struct object_id discard; char *full; - switch (dwim_ref(name, strlen(name), discard.hash, &full)) { + switch (dwim_ref(name, strlen(name), &discard, &full)) { case 0: /* * Not found -- not a ref. We could diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 0237be4975..722a7f4bec 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -720,7 +720,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) die(Q_("only %d entry can be shown at one time.", "only %d entries can be shown at one time.", MAX_REVS), MAX_REVS); - if (!dwim_ref(*av, strlen(*av), oid.hash, &ref)) + if (!dwim_ref(*av, strlen(*av), &oid, &ref)) die(_("no such ref %s"), *av); /* Has the base been specified? */ -- cgit v1.2.3