sha1-name.c: remove the_repo from get_short_oid()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Apr 16, 2019 at 16:33 UTC c6c0235b15a7eb9aed3aac6b9974d992c12b7b50
1 file changed +10 -7
sha1-name.c
+10 -7
@@ -436,7 +436,8 @@ static void sort_ambiguous_oid_array(struct repository *r, struct oid_array *a)
436 sort_ambiguous_repo = NULL;
437 }
438
439 -static enum get_oid_result get_short_oid(const char *name, int len,
439 +static enum get_oid_result get_short_oid(struct repository *r,
440 + const char *name, int len,
441 struct object_id *oid,
442 unsigned flags)
443 {
@@ -444,7 +445,7 @@ static enum get_oid_result get_short_oid(const char *name, int len,
445 struct disambiguate_state ds;
446 int quietly = !!(flags & GET_OID_QUIETLY);
447
447 - if (init_object_disambiguation(the_repository, name, len, &ds) < 0)
448 + if (init_object_disambiguation(r, name, len, &ds) < 0)
449 return -1;
450
451 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,
483 ds.fn = NULL;
484
485 advise(_("The candidates are:"));
485 - for_each_abbrev(ds.hex_pfx, collect_ambiguous, &collect);
486 - sort_ambiguous_oid_array(the_repository, &collect);
486 + repo_for_each_abbrev(r, ds.hex_pfx, collect_ambiguous, &collect);
487 + sort_ambiguous_oid_array(r, &collect);
488
489 if (oid_array_for_each(&collect, show_ambiguous_object, &ds))
490 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,
856
857 if (warn_ambiguous_refs && !(flags & GET_OID_QUIETLY) &&
858 (refs_found > 1 ||
858 - !get_short_oid(str, len, &tmp_oid, GET_OID_QUIETLY)))
859 + !get_short_oid(the_repository,
860 + str, len, &tmp_oid, GET_OID_QUIETLY)))
861 warning(warn_msg, len, str);
862
863 if (reflog_len) {
@@ -1109,7 +1111,8 @@ static int get_describe_name(const char *name, int len, struct object_id *oid)
1111 if (ch == 'g' && cp[-1] == '-') {
1112 cp++;
1113 len -= cp - name;
1112 - return get_short_oid(cp, len, oid, flags);
1114 + return get_short_oid(the_repository,
1115 + cp, len, oid, flags);
1116 }
1117 }
1118 }
@@ -1163,7 +1166,7 @@ static enum get_oid_result get_oid_1(const char *name, int len,
1166 if (!ret)
1167 return FOUND;
1168
1166 - return get_short_oid(name, len, oid, lookup_flags);
1169 + return get_short_oid(the_repository, name, len, oid, lookup_flags);
1170 }
1171
1172 /*