Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
refs.c: add repo_dwim_log()
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 6 Apr 2019 11:34:29 +0000
(18:34 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 8 Apr 2019 08:26:33 +0000
(17:26 +0900)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
patch
|
blob
|
history
refs.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
d8984c5
)
diff --git
a/refs.c
b/refs.c
index bd0fec5776d011c33640fc41bfa64624c95a84be..edea0014467b0dd25000d35ec0aa858eaa0b58fc 100644
(file)
--- a/
refs.c
+++ b/
refs.c
@@
-603,9
+603,11
@@
int expand_ref(struct repository *repo, const char *str, int len,
return refs_found;
}
return refs_found;
}
-int dwim_log(const char *str, int len, struct object_id *oid, char **log)
+int repo_dwim_log(struct repository *r, const char *str, int len,
+ struct object_id *oid, char **log)
{
{
- char *last_branch = substitute_branch_name(the_repository, &str, &len);
+ struct ref_store *refs = get_main_ref_store(r);
+ char *last_branch = substitute_branch_name(r, &str, &len);
const char **p;
int logs_found = 0;
struct strbuf path = STRBUF_INIT;
const char **p;
int logs_found = 0;
struct strbuf path = STRBUF_INIT;
@@
-617,13
+619,15
@@
int dwim_log(const char *str, int len, struct object_id *oid, char **log)
strbuf_reset(&path);
strbuf_addf(&path, *p, len, str);
strbuf_reset(&path);
strbuf_addf(&path, *p, len, str);
- ref = resolve_ref_unsafe(path.buf, RESOLVE_REF_READING,
- &hash, NULL);
+ ref = refs_resolve_ref_unsafe(refs, path.buf,
+ RESOLVE_REF_READING,
+ &hash, NULL);
if (!ref)
continue;
if (!ref)
continue;
- if (ref
log_exists(
path.buf))
+ if (ref
s_reflog_exists(refs,
path.buf))
it = path.buf;
it = path.buf;
- else if (strcmp(ref, path.buf) && reflog_exists(ref))
+ else if (strcmp(ref, path.buf) &&
+ refs_reflog_exists(refs, ref))
it = ref;
else
continue;
it = ref;
else
continue;
@@
-639,6
+643,11
@@
int dwim_log(const char *str, int len, struct object_id *oid, char **log)
return logs_found;
}
return logs_found;
}
+int dwim_log(const char *str, int len, struct object_id *oid, char **log)
+{
+ return repo_dwim_log(the_repository, str, len, oid, log);
+}
+
static int is_per_worktree_ref(const char *refname)
{
return !strcmp(refname, "HEAD") ||
static int is_per_worktree_ref(const char *refname)
{
return !strcmp(refname, "HEAD") ||
diff --git
a/refs.h
b/refs.h
index fd3dc1d0f4a5cfae869aa44af936d382582d0060..859dffe69182524cb666a68a97b2a3764d4306fa 100644
(file)
--- a/
refs.h
+++ b/
refs.h
@@
-150,6
+150,7
@@
void expand_ref_prefix(struct argv_array *prefixes, const char *prefix);
int expand_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
int repo_dwim_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
int expand_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
int repo_dwim_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
+int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);