commit.c: allow lookup_commit_reference_gently to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jun 28, 2018 at 18:22 UTC d9a05e74ec01bb59fccb70c005269d930cd60d9a
2 files changed +5 -7
commit.c
+4 -4
@@ -24,16 +24,16 @@ int save_commit_buffer = 1;
24
25 const char *commit_type = "commit";
26
27 -struct commit *lookup_commit_reference_gently_the_repository(
27 +struct commit *lookup_commit_reference_gently(struct repository *r,
28 const struct object_id *oid, int quiet)
29 {
30 - struct object *obj = deref_tag(the_repository,
31 - parse_object(the_repository, oid),
30 + struct object *obj = deref_tag(r,
31 + parse_object(r, oid),
32 NULL, 0);
33
34 if (!obj)
35 return NULL;
36 - return object_as_type(the_repository, obj, OBJ_COMMIT, quiet);
36 + return object_as_type(r, obj, OBJ_COMMIT, quiet);
37 }
38
39 struct commit *lookup_commit_reference_the_repository(const struct object_id *oid)
commit.h
+1 -3
@@ -67,9 +67,7 @@ struct commit *lookup_commit(struct repository *r, const struct object_id *oid);
67 #define lookup_commit_reference(r, o) \
68 lookup_commit_reference_##r(o)
69 struct commit *lookup_commit_reference_the_repository(const struct object_id *oid);
70 -#define lookup_commit_reference_gently(r, o, q) \
71 - lookup_commit_reference_gently_##r(o, q)
72 -struct commit *lookup_commit_reference_gently_the_repository(
70 +struct commit *lookup_commit_reference_gently(struct repository *r,
71 const struct object_id *oid,
72 int quiet);
73 struct commit *lookup_commit_reference_by_name(const char *name);