refs.c: remove the_repo from expand_ref()
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 6 Apr 2019 11:34:27 +0000 (18:34 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Apr 2019 08:26:33 +0000 (17:26 +0900)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h
upload-pack.c
diff --git a/refs.c b/refs.c
index 44df0497965ba296d26c58db59fb36ebf1012ab4..1f5864aa364e6c1c742eb86e73638f028a379f65 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -558,12 +558,13 @@ static char *substitute_branch_name(struct repository *r,
 int dwim_ref(const char *str, int len, struct object_id *oid, char **ref)
 {
        char *last_branch = substitute_branch_name(the_repository, &str, &len);
-       int   refs_found  = expand_ref(str, len, oid, ref);
+       int   refs_found  = expand_ref(the_repository, str, len, oid, ref);
        free(last_branch);
        return refs_found;
 }
 
-int expand_ref(const char *str, int len, struct object_id *oid, char **ref)
+int expand_ref(struct repository *repo, const char *str, int len,
+              struct object_id *oid, char **ref)
 {
        const char **p, *r;
        int refs_found = 0;
@@ -578,8 +579,9 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref)
                this_result = refs_found ? &oid_from_ref : oid;
                strbuf_reset(&fullref);
                strbuf_addf(&fullref, *p, len, str);
-               r = resolve_ref_unsafe(fullref.buf, RESOLVE_REF_READING,
-                                      this_result, &flag);
+               r = refs_resolve_ref_unsafe(get_main_ref_store(repo),
+                                           fullref.buf, RESOLVE_REF_READING,
+                                           this_result, &flag);
                if (r) {
                        if (!refs_found++)
                                *ref = xstrdup(r);
diff --git a/refs.h b/refs.h
index 56275702418168d0af4838a680f0ea27193fa604..b630d5bde7aac767768f7446731147c988ec9cd4 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -148,7 +148,7 @@ int refname_match(const char *abbrev_name, const char *full_name);
 struct argv_array;
 void expand_ref_prefix(struct argv_array *prefixes, const char *prefix);
 
-int expand_ref(const char *str, int len, struct object_id *oid, char **ref);
+int expand_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
 int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
 int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
 
index d098ef598289d16956309cb73d4518a92c1206af..56505d60c341ed4f718de23307fe52ce05d838fa 100644 (file)
@@ -834,7 +834,7 @@ static int process_deepen_not(const char *line, struct string_list *deepen_not,
        if (skip_prefix(line, "deepen-not ", &arg)) {
                char *ref = NULL;
                struct object_id oid;
-               if (expand_ref(arg, strlen(arg), &oid, &ref) != 1)
+               if (expand_ref(the_repository, arg, strlen(arg), &oid, &ref) != 1)
                        die("git upload-pack: ambiguous deepen-not: %s", line);
                string_list_append(deepen_not, ref);
                free(ref);