Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1-name.c: remove the_repo from handle_one_ref()
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Tue, 16 Apr 2019 09:33:33 +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:
2b1790f
)
diff --git
a/sha1-name.c
b/sha1-name.c
index 5741a9f821374e442a47bd2dc078e066dd85faac..d9050776dde740d3d81748953d739ca4e076522e 100644
(file)
--- a/
sha1-name.c
+++ b/
sha1-name.c
@@
-1189,15
+1189,21
@@
static enum get_oid_result get_oid_1(struct repository *r,
/* Remember to update object flag allocation in object.h */
#define ONELINE_SEEN (1u<<20)
/* Remember to update object flag allocation in object.h */
#define ONELINE_SEEN (1u<<20)
+struct handle_one_ref_cb {
+ struct repository *repo;
+ struct commit_list **list;
+};
+
static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
- struct commit_list **list = cb_data;
- struct object *object = parse_object(the_repository, oid);
+ struct handle_one_ref_cb *cb = cb_data;
+ struct commit_list **list = cb->list;
+ struct object *object = parse_object(cb->repo, oid);
if (!object)
return 0;
if (object->type == OBJ_TAG) {
if (!object)
return 0;
if (object->type == OBJ_TAG) {
- object = deref_tag(
the_repository
, object, path,
+ object = deref_tag(
cb->repo
, object, path,
strlen(path));
if (!object)
return 0;
strlen(path));
if (!object)
return 0;
@@
-1760,10
+1766,13
@@
static enum get_oid_result get_oid_with_context_1(struct repository *repo,
char *new_path = NULL;
int pos;
if (!only_to_die && namelen > 2 && name[1] == '/') {
char *new_path = NULL;
int pos;
if (!only_to_die && namelen > 2 && name[1] == '/') {
+ struct handle_one_ref_cb cb;
struct commit_list *list = NULL;
struct commit_list *list = NULL;
- for_each_ref(handle_one_ref, &list);
- head_ref(handle_one_ref, &list);
+ cb.repo = repo;
+ cb.list = &list;
+ refs_for_each_ref(repo->refs, handle_one_ref, &cb);
+ refs_head_ref(repo->refs, handle_one_ref, &cb);
commit_list_sort_by_date(&list);
return get_oid_oneline(repo, name + 2, oid, list);
}
commit_list_sort_by_date(&list);
return get_oid_oneline(repo, name + 2, oid, list);
}