Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1-name.c: remove the_repo from get_oid_basic()
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Tue, 16 Apr 2019 09:33:31 +0000
(16:33 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 16 Apr 2019 09:56:53 +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
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
0c6b5ba
)
diff --git
a/sha1-name.c
b/sha1-name.c
index 1cda854f023eff4c5f1179bfb6f094faae9df860..d4c135aea8838f407f6e8ddad600d637caef0a26 100644
(file)
--- 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 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_(
{
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;
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) {
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)
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;
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;
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 */
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)
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
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 ||
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) {
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;
}
}
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) {
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;
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;
if (!ret)
return FOUND;