]> granicus.if.org Git - git/commitdiff
sha1-name.c: remove the_repo from get_short_oid()
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Tue, 16 Apr 2019 09:33:25 +0000 (16:33 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Apr 2019 09:56:52 +0000 (18:56 +0900)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1-name.c

index cdcf84b826234d92f057305e2431a6d9b609202d..2643b75b543c91a553db657c8ef2af04cd7fae91 100644 (file)
@@ -436,7 +436,8 @@ static void sort_ambiguous_oid_array(struct repository *r, struct oid_array *a)
        sort_ambiguous_repo = NULL;
 }
 
-static enum get_oid_result get_short_oid(const char *name, int len,
+static enum get_oid_result get_short_oid(struct repository *r,
+                                        const char *name, int len,
                                         struct object_id *oid,
                                         unsigned flags)
 {
@@ -444,7 +445,7 @@ static enum get_oid_result get_short_oid(const char *name, int len,
        struct disambiguate_state ds;
        int quietly = !!(flags & GET_OID_QUIETLY);
 
-       if (init_object_disambiguation(the_repository, name, len, &ds) < 0)
+       if (init_object_disambiguation(r, name, len, &ds) < 0)
                return -1;
 
        if (HAS_MULTI_BITS(flags & GET_OID_DISAMBIGUATORS))
@@ -482,8 +483,8 @@ static enum get_oid_result get_short_oid(const char *name, int len,
                        ds.fn = NULL;
 
                advise(_("The candidates are:"));
-               for_each_abbrev(ds.hex_pfx, collect_ambiguous, &collect);
-               sort_ambiguous_oid_array(the_repository, &collect);
+               repo_for_each_abbrev(r, ds.hex_pfx, collect_ambiguous, &collect);
+               sort_ambiguous_oid_array(r, &collect);
 
                if (oid_array_for_each(&collect, show_ambiguous_object, &ds))
                        BUG("show_ambiguous_object shouldn't return non-zero");
@@ -855,7 +856,8 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
 
        if (warn_ambiguous_refs && !(flags & GET_OID_QUIETLY) &&
            (refs_found > 1 ||
-            !get_short_oid(str, len, &tmp_oid, GET_OID_QUIETLY)))
+            !get_short_oid(the_repository,
+                           str, len, &tmp_oid, GET_OID_QUIETLY)))
                warning(warn_msg, len, str);
 
        if (reflog_len) {
@@ -1109,7 +1111,8 @@ static int get_describe_name(const char *name, int len, struct object_id *oid)
                        if (ch == 'g' && cp[-1] == '-') {
                                cp++;
                                len -= cp - name;
-                               return get_short_oid(cp, len, oid, flags);
+                               return get_short_oid(the_repository,
+                                                    cp, len, oid, flags);
                        }
                }
        }
@@ -1163,7 +1166,7 @@ static enum get_oid_result get_oid_1(const char *name, int len,
        if (!ret)
                return FOUND;
 
-       return get_short_oid(name, len, oid, lookup_flags);
+       return get_short_oid(the_repository, name, len, oid, lookup_flags);
 }
 
 /*