sha1-name.c: remove the_repo from handle_one_ref()

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:
Nguyễn Thái Ngọc Duy 2019-04-16 16:33:33 +07:00 committed by Junio C Hamano
parent 2b1790f5ab
commit c931ba4e78

View File

@ -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)
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)
{
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) {
object = deref_tag(the_repository, object, path,
object = deref_tag(cb->repo, object, path,
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] == '/') {
struct handle_one_ref_cb cb;
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);
}