зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
4e99f2dbea
Коммит
c6c0235b15
17
sha1-name.c
17
sha1-name.c
|
@ -436,7 +436,8 @@ static void sort_ambiguous_oid_array(struct repository *r, struct oid_array *a)
|
||||||
sort_ambiguous_repo = NULL;
|
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,
|
struct object_id *oid,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
{
|
{
|
||||||
|
@ -444,7 +445,7 @@ static enum get_oid_result get_short_oid(const char *name, int len,
|
||||||
struct disambiguate_state ds;
|
struct disambiguate_state ds;
|
||||||
int quietly = !!(flags & GET_OID_QUIETLY);
|
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;
|
return -1;
|
||||||
|
|
||||||
if (HAS_MULTI_BITS(flags & GET_OID_DISAMBIGUATORS))
|
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;
|
ds.fn = NULL;
|
||||||
|
|
||||||
advise(_("The candidates are:"));
|
advise(_("The candidates are:"));
|
||||||
for_each_abbrev(ds.hex_pfx, collect_ambiguous, &collect);
|
repo_for_each_abbrev(r, ds.hex_pfx, collect_ambiguous, &collect);
|
||||||
sort_ambiguous_oid_array(the_repository, &collect);
|
sort_ambiguous_oid_array(r, &collect);
|
||||||
|
|
||||||
if (oid_array_for_each(&collect, show_ambiguous_object, &ds))
|
if (oid_array_for_each(&collect, show_ambiguous_object, &ds))
|
||||||
BUG("show_ambiguous_object shouldn't return non-zero");
|
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) &&
|
if (warn_ambiguous_refs && !(flags & GET_OID_QUIETLY) &&
|
||||||
(refs_found > 1 ||
|
(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);
|
warning(warn_msg, len, str);
|
||||||
|
|
||||||
if (reflog_len) {
|
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] == '-') {
|
if (ch == 'g' && cp[-1] == '-') {
|
||||||
cp++;
|
cp++;
|
||||||
len -= cp - name;
|
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)
|
if (!ret)
|
||||||
return FOUND;
|
return FOUND;
|
||||||
|
|
||||||
return get_short_oid(name, len, oid, lookup_flags);
|
return get_short_oid(the_repository, name, len, oid, lookup_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче