sha1-name.c: remove the_repo from get_oid_oneline()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Apr 16, 2019 at 16:33 UTC
0bb41a1985e52dad56c380dcc3cd1c83ecc4a0a3
1 file changed
+7
-6
sha1-name.c
+7
-6
@@ -15,7 +15,7 @@
15
#include "midx.h"
16
#include "commit-reach.h"
17
18
-static int get_oid_oneline(const char *, struct object_id *, struct commit_list *);
18
+static int get_oid_oneline(struct repository *r, const char *, struct object_id *, struct commit_list *);
19
20
typedef int (*disambiguate_hint_fn)(struct repository *, const struct object_id *, void *);
21
@@ -1090,7 +1090,7 @@ static int peel_onion(const char *name, int len, struct object_id *oid,
1090
1091
prefix = xstrndup(sp + 1, name + len - 1 - (sp + 1));
1092
commit_list_insert((struct commit *)o, &list);
1093
- ret = get_oid_oneline(prefix, oid, list);
1093
+ ret = get_oid_oneline(the_repository, prefix, oid, list);
1094
free(prefix);
1095
return ret;
1096
}
@@ -1204,8 +1204,9 @@ static int handle_one_ref(const char *path, const struct object_id *oid,
1204
return 0;
1205
}
1206
1207
-static int get_oid_oneline(const char *prefix, struct object_id *oid,
1208
- struct commit_list *list)
1207
+static int get_oid_oneline(struct repository *r,
1208
+ const char *prefix, struct object_id *oid,
1209
+ struct commit_list *list)
1210
{
1211
struct commit_list *backup = NULL, *l;
1212
int found = 0;
@@ -1236,7 +1237,7 @@ static int get_oid_oneline(const char *prefix, struct object_id *oid,
1237
int matches;
1238
1239
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
1239
- if (!parse_object(the_repository, &commit->object.oid))
1240
+ if (!parse_object(r, &commit->object.oid))
1241
continue;
1242
buf = get_commit_buffer(commit, NULL);
1243
p = strstr(buf, "\n\n");
@@ -1760,7 +1761,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
1761
for_each_ref(handle_one_ref, &list);
1762
head_ref(handle_one_ref, &list);
1763
commit_list_sort_by_date(&list);
1763
- return get_oid_oneline(name + 2, oid, list);
1764
+ return get_oid_oneline(repo, name + 2, oid, list);
1765
}
1766
if (namelen < 3 ||
1767
name[2] != ':' ||