diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-03-28 16:58:54 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-03-28 17:36:46 +0300 |
commit | 12cb1c10a64170a5d600dd1c6c8abfeec105fb6b (patch) | |
tree | 2209f7a97ef9e13aa6979efacd4f6dc93f23d5f7 /builtin | |
parent | a5183d7696db34433ebcae64bad7609d5bb3a744 (diff) |
cocci: apply the "refs.h" part of "the_repository.pending"
Apply the part of "the_repository.pending.cocci" pertaining to
"refs.h".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 6 | ||||
-rw-r--r-- | builtin/fast-export.c | 3 | ||||
-rw-r--r-- | builtin/log.c | 3 | ||||
-rw-r--r-- | builtin/merge.c | 3 | ||||
-rw-r--r-- | builtin/reset.c | 3 | ||||
-rw-r--r-- | builtin/rev-parse.c | 4 | ||||
-rw-r--r-- | builtin/show-branch.c | 3 | ||||
-rw-r--r-- | builtin/stash.c | 3 |
8 files changed, 19 insertions, 9 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 1d1f33e33e..cb7cd315b3 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -703,7 +703,8 @@ static void setup_branch_path(struct branch_info *branch) * If this is a ref, resolve it; otherwise, look up the OID for our * expression. Failure here is okay. */ - if (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname, 0)) + if (!repo_dwim_ref(the_repository, branch->name, strlen(branch->name), + &branch->oid, &branch->refname, 0)) repo_get_oid_committish(the_repository, branch->name, &branch->oid); strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL); @@ -1424,7 +1425,8 @@ static void die_expecting_a_branch(const struct branch_info *branch_info) char *to_free; int code; - if (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) { + if (repo_dwim_ref(the_repository, branch_info->name, + strlen(branch_info->name), &oid, &to_free, 0) == 1) { const char *ref = to_free; if (skip_prefix(ref, "refs/tags/", &ref)) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 6515bd2ad8..550f078a8e 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -918,7 +918,8 @@ 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, &full_name, 0) != 1) + if (repo_dwim_ref(the_repository, e->name, strlen(e->name), + &oid, &full_name, 0) != 1) continue; if (refspecs.nr) { diff --git a/builtin/log.c b/builtin/log.c index 3dde77bde2..acf3faecd8 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1204,7 +1204,8 @@ 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, &full_ref, 0) && + if (repo_dwim_ref(the_repository, ref, strlen(ref), &branch_oid, + &full_ref, 0) && skip_prefix(full_ref, "refs/heads/", &v) && oideq(tip_oid, &branch_oid)) branch = xstrdup(v); diff --git a/builtin/merge.c b/builtin/merge.c index 197e152aba..69666546ca 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -517,7 +517,8 @@ 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, &found_ref, 0) > 0) { + if (repo_dwim_ref(the_repository, remote, strlen(remote), &branch_head, + &found_ref, 0) > 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/reset.c b/builtin/reset.c index 75b447ffdc..b65f379440 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -465,7 +465,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix) char *ref = NULL; int err; - dwim_ref(rev, strlen(rev), &dummy, &ref, 0); + repo_dwim_ref(the_repository, rev, strlen(rev), + &dummy, &ref, 0); if (ref && !starts_with(ref, "refs/")) FREE_AND_NULL(ref); diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 5685cf0ea7..663f282c5f 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -136,7 +136,9 @@ 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, &full, 0)) { + switch (repo_dwim_ref(the_repository, name, + strlen(name), &discard, &full, + 0)) { case 0: /* * Not found -- not a ref. We could diff --git a/builtin/show-branch.c b/builtin/show-branch.c index d60e536a53..af680485d5 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -746,7 +746,8 @@ 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, &ref, 0)) + if (!repo_dwim_ref(the_repository, *av, strlen(*av), &oid, + &ref, 0)) die(_("no such ref %s"), *av); /* Has the base been specified? */ diff --git a/builtin/stash.c b/builtin/stash.c index 6c062e5204..364273f101 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -211,7 +211,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv) end_of_rev = strchrnul(revision, '@'); strbuf_add(&symbolic, revision, end_of_rev - revision); - ret = dwim_ref(symbolic.buf, symbolic.len, &dummy, &expanded_ref, 0); + ret = repo_dwim_ref(the_repository, symbolic.buf, symbolic.len, + &dummy, &expanded_ref, 0); strbuf_release(&symbolic); switch (ret) { case 0: /* Not found, but valid ref */ |