mirror of
https://github.com/git/git.git
synced 2024-05-09 16:06:10 +02:00
commit.c: allow get_cached_commit_buffer 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:
parent
1a40fc4509
commit
4ff7e5c936
4
commit.c
4
commit.c
|
@ -283,10 +283,10 @@ void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer
|
||||||
v->size = size;
|
v->size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *get_cached_commit_buffer_the_repository(const struct commit *commit, unsigned long *sizep)
|
const void *get_cached_commit_buffer(struct repository *r, const struct commit *commit, unsigned long *sizep)
|
||||||
{
|
{
|
||||||
struct commit_buffer *v = buffer_slab_peek(
|
struct commit_buffer *v = buffer_slab_peek(
|
||||||
the_repository->parsed_objects->buffer_slab, commit);
|
r->parsed_objects->buffer_slab, commit);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
if (sizep)
|
if (sizep)
|
||||||
*sizep = 0;
|
*sizep = 0;
|
||||||
|
|
3
commit.h
3
commit.h
|
@ -103,8 +103,7 @@ void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsi
|
||||||
* Get any cached object buffer associated with the commit. Returns NULL
|
* Get any cached object buffer associated with the commit. Returns NULL
|
||||||
* if none. The resulting memory should not be freed.
|
* if none. The resulting memory should not be freed.
|
||||||
*/
|
*/
|
||||||
#define get_cached_commit_buffer(r, c, s) get_cached_commit_buffer_##r(c, s)
|
const void *get_cached_commit_buffer(struct repository *, const struct commit *, unsigned long *size);
|
||||||
const void *get_cached_commit_buffer_the_repository(const struct commit *, unsigned long *size);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the commit's object contents, either from cache or by reading the object
|
* Get the commit's object contents, either from cache or by reading the object
|
||||||
|
|
Loading…
Reference in New Issue