diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-04-16 09:33:33 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-16 09:56:53 (GMT) |
commit | c931ba4e7806d4e76d367153cb8eaae022b83be7 (patch) | |
tree | f0da9e9ef72024bdfae15f501e6e7ac404168c67 /sha1-name.c | |
parent | 2b1790f5ab949abc86124d107ee4b7e7fef1323c (diff) | |
download | git-c931ba4e7806d4e76d367153cb8eaae022b83be7.zip git-c931ba4e7806d4e76d367153cb8eaae022b83be7.tar.gz git-c931ba4e7806d4e76d367153cb8eaae022b83be7.tar.bz2 |
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>
Diffstat (limited to 'sha1-name.c')
-rw-r--r-- | sha1-name.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sha1-name.c b/sha1-name.c index 5741a9f..d905077 100644 --- 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) +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); } |