1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 14:56:07 +02:00

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>
This commit is contained in:
Stefan Beller 2018-06-28 18:22:21 -07:00 committed by Junio C Hamano
parent 286d258d4f
commit d9a05e74ec
2 changed files with 5 additions and 7 deletions

View File

@ -24,16 +24,16 @@ int save_commit_buffer = 1;
const char *commit_type = "commit"; const char *commit_type = "commit";
struct commit *lookup_commit_reference_gently_the_repository( struct commit *lookup_commit_reference_gently(struct repository *r,
const struct object_id *oid, int quiet) const struct object_id *oid, int quiet)
{ {
struct object *obj = deref_tag(the_repository, struct object *obj = deref_tag(r,
parse_object(the_repository, oid), parse_object(r, oid),
NULL, 0); NULL, 0);
if (!obj) if (!obj)
return NULL; return NULL;
return object_as_type(the_repository, obj, OBJ_COMMIT, quiet); return object_as_type(r, obj, OBJ_COMMIT, quiet);
} }
struct commit *lookup_commit_reference_the_repository(const struct object_id *oid) struct commit *lookup_commit_reference_the_repository(const struct object_id *oid)

View File

@ -67,9 +67,7 @@ struct commit *lookup_commit(struct repository *r, const struct object_id *oid);
#define lookup_commit_reference(r, o) \ #define lookup_commit_reference(r, o) \
lookup_commit_reference_##r(o) lookup_commit_reference_##r(o)
struct commit *lookup_commit_reference_the_repository(const struct object_id *oid); struct commit *lookup_commit_reference_the_repository(const struct object_id *oid);
#define lookup_commit_reference_gently(r, o, q) \ struct commit *lookup_commit_reference_gently(struct repository *r,
lookup_commit_reference_gently_##r(o, q)
struct commit *lookup_commit_reference_gently_the_repository(
const struct object_id *oid, const struct object_id *oid,
int quiet); int quiet);
struct commit *lookup_commit_reference_by_name(const char *name); struct commit *lookup_commit_reference_by_name(const char *name);