summaryrefslogtreecommitdiff
path: root/sha1-name.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-04-16 09:33:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-16 09:56:52 (GMT)
commitc6c0235b15a7eb9aed3aac6b9974d992c12b7b50 (patch)
treed305d16976e1df9c40a7c4c23ec20ca901729797 /sha1-name.c
parent4e99f2dbea542bc5d7f696f7a358737eb521f040 (diff)
downloadgit-c6c0235b15a7eb9aed3aac6b9974d992c12b7b50.zip
git-c6c0235b15a7eb9aed3aac6b9974d992c12b7b50.tar.gz
git-c6c0235b15a7eb9aed3aac6b9974d992c12b7b50.tar.bz2
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>
Diffstat (limited to 'sha1-name.c')
-rw-r--r--sha1-name.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sha1-name.c b/sha1-name.c
index cdcf84b..2643b75 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -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);
}
/*