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:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-16 09:56:53 (GMT)
commit49281cf54433c68ce488d41675681116b6b31b47 (patch)
treeed25dac069b3a59242ce3a08aa7960f7b3db78de /sha1-name.c
parent0c6b5ba1bbed9ba1bff9f1d879601755c13f291c (diff)
downloadgit-49281cf54433c68ce488d41675681116b6b31b47.zip
git-49281cf54433c68ce488d41675681116b6b31b47.tar.gz
git-49281cf54433c68ce488d41675681116b6b31b47.tar.bz2
sha1-name.c: remove the_repo from get_oid_basic()
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.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sha1-name.c b/sha1-name.c
index 1cda854..d4c135a 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -773,8 +773,8 @@ static inline int push_mark(const char *string, int len)
static enum get_oid_result get_oid_1(const char *name, int len, struct object_id *oid, unsigned lookup_flags);
static int interpret_nth_prior_checkout(struct repository *r, const char *name, int namelen, struct strbuf *buf);
-static int get_oid_basic(const char *str, int len, struct object_id *oid,
- unsigned int flags)
+static int get_oid_basic(struct repository *r, const char *str, int len,
+ struct object_id *oid, unsigned int flags)
{
static const char *warn_msg = "refname '%.*s' is ambiguous.";
static const char *object_name_msg = N_(
@@ -792,9 +792,9 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
int refs_found = 0;
int at, reflog_len, nth_prior = 0;
- if (len == the_hash_algo->hexsz && !get_oid_hex(str, oid)) {
+ if (len == r->hash_algo->hexsz && !get_oid_hex(str, oid)) {
if (warn_ambiguous_refs && warn_on_object_refname_ambiguity) {
- refs_found = dwim_ref(str, len, &tmp_oid, &real_ref);
+ refs_found = repo_dwim_ref(r, str, len, &tmp_oid, &real_ref);
if (refs_found > 0) {
warning(warn_msg, len, str);
if (advice_object_name_warning)
@@ -835,8 +835,8 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
struct strbuf buf = STRBUF_INIT;
int detached;
- if (interpret_nth_prior_checkout(the_repository, str, len, &buf) > 0) {
- detached = (buf.len == the_hash_algo->hexsz && !get_oid_hex(buf.buf, oid));
+ if (interpret_nth_prior_checkout(r, str, len, &buf) > 0) {
+ detached = (buf.len == r->hash_algo->hexsz && !get_oid_hex(buf.buf, oid));
strbuf_release(&buf);
if (detached)
return 0;
@@ -845,19 +845,18 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
if (!len && reflog_len)
/* allow "@{...}" to mean the current branch reflog */
- refs_found = dwim_ref("HEAD", 4, oid, &real_ref);
+ refs_found = repo_dwim_ref(r, "HEAD", 4, oid, &real_ref);
else if (reflog_len)
- refs_found = dwim_log(str, len, oid, &real_ref);
+ refs_found = repo_dwim_log(r, str, len, oid, &real_ref);
else
- refs_found = dwim_ref(str, len, oid, &real_ref);
+ refs_found = repo_dwim_ref(r, str, len, oid, &real_ref);
if (!refs_found)
return -1;
if (warn_ambiguous_refs && !(flags & GET_OID_QUIETLY) &&
(refs_found > 1 ||
- !get_short_oid(the_repository,
- str, len, &tmp_oid, GET_OID_QUIETLY)))
+ !get_short_oid(r, str, len, &tmp_oid, GET_OID_QUIETLY)))
warning(warn_msg, len, str);
if (reflog_len) {
@@ -889,7 +888,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
return -1;
}
}
- if (read_ref_at(get_main_ref_store(the_repository),
+ if (read_ref_at(get_main_ref_store(r),
real_ref, flags, at_time, nth, oid, NULL,
&co_time, &co_tz, &co_cnt)) {
if (!len) {
@@ -1159,7 +1158,7 @@ static enum get_oid_result get_oid_1(const char *name, int len,
if (!ret)
return FOUND;
- ret = get_oid_basic(name, len, oid, lookup_flags);
+ ret = get_oid_basic(the_repository, name, len, oid, lookup_flags);
if (!ret)
return FOUND;