Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
commit: allow lookup_commit to handle arbitrary repositories
author
Stefan Beller
<sbeller@google.com>
Fri, 29 Jun 2018 01:22:10 +0000
(18:22 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 29 Jun 2018 17:43:39 +0000
(10:43 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c
patch
|
blob
|
history
commit.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
f58a6cb
)
diff --git
a/commit.c
b/commit.c
index aa5557dee847a1c1d1de0c7827c80794c74b6652..8749e15145105e5a291e087ef6f50d134d58540a 100644
(file)
--- a/
commit.c
+++ b/
commit.c
@@
-53,13
+53,13
@@
struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref
return c;
}
return c;
}
-struct commit *lookup_commit
_the_repository(
const struct object_id *oid)
+struct commit *lookup_commit
(struct repository *r,
const struct object_id *oid)
{
{
- struct object *obj = lookup_object(
the_repository
, oid->hash);
+ struct object *obj = lookup_object(
r
, oid->hash);
if (!obj)
if (!obj)
- return create_object(
the_repository
, oid->hash,
- alloc_commit_node(
the_repository
));
- return object_as_type(
the_repository
, obj, OBJ_COMMIT, 0);
+ return create_object(
r
, oid->hash,
+ alloc_commit_node(
r
));
+ return object_as_type(
r
, obj, OBJ_COMMIT, 0);
}
struct commit *lookup_commit_reference_by_name(const char *name)
}
struct commit *lookup_commit_reference_by_name(const char *name)
diff --git
a/commit.h
b/commit.h
index 237607d64cb207634f3c72e60aae21402e1ee567..27888d824686e4f11527f250e7663127e0e6558d 100644
(file)
--- a/
commit.h
+++ b/
commit.h
@@
-63,8
+63,7
@@
enum decoration_type {
void add_name_decoration(enum decoration_type type, const char *name, struct object *obj);
const struct name_decoration *get_name_decoration(const struct object *obj);
void add_name_decoration(enum decoration_type type, const char *name, struct object *obj);
const struct name_decoration *get_name_decoration(const struct object *obj);
-#define lookup_commit(r, o) lookup_commit_##r(o)
-struct commit *lookup_commit_the_repository(const struct object_id *oid);
+struct commit *lookup_commit(struct repository *r, const struct object_id *oid);
#define lookup_commit_reference(r, o) \
lookup_commit_reference_##r(o)
struct commit *lookup_commit_reference_the_repository(const struct object_id *oid);
#define lookup_commit_reference(r, o) \
lookup_commit_reference_##r(o)
struct commit *lookup_commit_reference_the_repository(const struct object_id *oid);