From 21e1ee8f4f4b7767d506b02504e97f6bcaef13a0 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:21:57 -0700 Subject: commit: add repository argument to lookup_commit_reference_gently Add a repository argument to allow callers of lookup_commit_reference_gently to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 01b8b1d689..000d194f8a 100644 --- a/commit.h +++ b/commit.h @@ -65,7 +65,10 @@ const struct name_decoration *get_name_decoration(const struct object *obj); struct commit *lookup_commit(const struct object_id *oid); struct commit *lookup_commit_reference(const struct object_id *oid); -struct commit *lookup_commit_reference_gently(const struct object_id *oid, +#define lookup_commit_reference_gently(r, o, q) \ + lookup_commit_reference_gently_##r(o, q) +struct commit *lookup_commit_reference_gently_the_repository( + const struct object_id *oid, int quiet); struct commit *lookup_commit_reference_by_name(const char *name); -- cgit v1.2.3 From 2122f6754c93be8f02bfb5704ed96c88fc9837a8 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:21:58 -0700 Subject: commit: add repository argument to lookup_commit_reference Add a repository argument to allow callers of lookup_commit_reference to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 000d194f8a..2a41113445 100644 --- a/commit.h +++ b/commit.h @@ -64,7 +64,9 @@ void add_name_decoration(enum decoration_type type, const char *name, struct obj const struct name_decoration *get_name_decoration(const struct object *obj); struct commit *lookup_commit(const struct object_id *oid); -struct commit *lookup_commit_reference(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_gently(r, o, q) \ lookup_commit_reference_gently_##r(o, q) struct commit *lookup_commit_reference_gently_the_repository( -- cgit v1.2.3 From c1f5eb49620d4f287af28509621a364e3888cfe7 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:21:59 -0700 Subject: commit: add repository argument to lookup_commit Add a repository argument to allow callers of lookup_commit to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 2a41113445..cd80dab59c 100644 --- a/commit.h +++ b/commit.h @@ -63,7 +63,8 @@ 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); -struct commit *lookup_commit(const struct object_id *oid); +#define lookup_commit(r, o) lookup_commit_##r(o) +struct commit *lookup_commit_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); -- cgit v1.2.3 From 08f4f44501bef21e10a1a449b8ba2d2710835b48 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:00 -0700 Subject: commit: add repository argument to parse_commit_buffer Add a repository argument to allow the callers of parse_commit_buffer to be more specific about which repository to act on. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Jonathan Nieder Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index cd80dab59c..f326c13622 100644 --- a/commit.h +++ b/commit.h @@ -82,7 +82,8 @@ struct commit *lookup_commit_reference_by_name(const char *name); */ struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref_name); -int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size, int check_graph); +#define parse_commit_buffer(r, i, b, s, g) parse_commit_buffer_##r(i, b, s, g) +int parse_commit_buffer_the_repository(struct commit *item, const void *buffer, unsigned long size, int check_graph); int parse_commit_gently(struct commit *item, int quiet_on_missing); static inline int parse_commit(struct commit *item) { -- cgit v1.2.3 From 5e0c63604dc1e5bb2e81f0f216cf31bd98f14210 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:01 -0700 Subject: commit: add repository argument to set_commit_buffer Add a repository argument to allow callers of set_commit_buffer to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index f326c13622..7c14dfdc54 100644 --- a/commit.h +++ b/commit.h @@ -95,7 +95,8 @@ void parse_commit_or_die(struct commit *item); * Associate an object buffer with the commit. The ownership of the * memory is handed over to the commit, and must be free()-able. */ -void set_commit_buffer(struct commit *, void *buffer, unsigned long size); +#define set_commit_buffer(r, c, b, s) set_commit_buffer_##r(c, b, s) +void set_commit_buffer_the_repository(struct commit *, void *buffer, unsigned long size); /* * Get any cached object buffer associated with the commit. Returns NULL -- cgit v1.2.3 From 3ce85f7e5a41116145179f0fae2ce6d86558d099 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:02 -0700 Subject: commit: add repository argument to get_cached_commit_buffer Add a repository argument to allow callers of get_cached_commit_buffer to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 7c14dfdc54..237607d64c 100644 --- a/commit.h +++ b/commit.h @@ -102,7 +102,8 @@ void set_commit_buffer_the_repository(struct commit *, void *buffer, unsigned lo * Get any cached object buffer associated with the commit. Returns NULL * if none. The resulting memory should not be freed. */ -const void *get_cached_commit_buffer(const struct commit *, unsigned long *size); +#define get_cached_commit_buffer(r, c, s) get_cached_commit_buffer_##r(c, s) +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 -- cgit v1.2.3 From bacf16874e0af1a34537d814274d66ae16d4cde8 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:10 -0700 Subject: commit: allow lookup_commit to handle arbitrary repositories Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 237607d64c..27888d8246 100644 --- 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); -#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); -- cgit v1.2.3 From fd8030c739522acf3f55879b29f4716b36f4d440 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:13 -0700 Subject: commit.c: allow parse_commit_buffer to handle arbitrary repositories Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 27888d8246..e9cb5aaaae 100644 --- a/commit.h +++ b/commit.h @@ -81,8 +81,7 @@ struct commit *lookup_commit_reference_by_name(const char *name); */ struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref_name); -#define parse_commit_buffer(r, i, b, s, g) parse_commit_buffer_##r(i, b, s, g) -int parse_commit_buffer_the_repository(struct commit *item, const void *buffer, unsigned long size, int check_graph); +int parse_commit_buffer(struct repository *r, struct commit *item, const void *buffer, unsigned long size, int check_graph); int parse_commit_gently(struct commit *item, int quiet_on_missing); static inline int parse_commit(struct commit *item) { -- cgit v1.2.3 From 65ea9d4bec141295d34955b286c32725fe3b422d Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:15 -0700 Subject: commit.c: migrate the commit buffer to the parsed object store Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'commit.h') diff --git a/commit.h b/commit.h index e9cb5aaaae..bea5e015b2 100644 --- a/commit.h +++ b/commit.h @@ -89,6 +89,10 @@ static inline int parse_commit(struct commit *item) } void parse_commit_or_die(struct commit *item); +struct buffer_slab; +struct buffer_slab *allocate_commit_buffer_slab(void); +void free_commit_buffer_slab(struct buffer_slab *bs); + /* * Associate an object buffer with the commit. The ownership of the * memory is handed over to the commit, and must be free()-able. -- cgit v1.2.3 From 1a40fc4509fb5369f089ed8774871e5e6974d3c2 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:16 -0700 Subject: commit.c: allow set_commit_buffer to handle arbitrary repositories Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index bea5e015b2..7297af467b 100644 --- a/commit.h +++ b/commit.h @@ -97,8 +97,7 @@ void free_commit_buffer_slab(struct buffer_slab *bs); * Associate an object buffer with the commit. The ownership of the * memory is handed over to the commit, and must be free()-able. */ -#define set_commit_buffer(r, c, b, s) set_commit_buffer_##r(c, b, s) -void set_commit_buffer_the_repository(struct commit *, void *buffer, unsigned long size); +void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsigned long size); /* * Get any cached object buffer associated with the commit. Returns NULL -- cgit v1.2.3 From 4ff7e5c9362875b2296fd2e289dba487a38609f0 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:17 -0700 Subject: commit.c: allow get_cached_commit_buffer to handle arbitrary repositories Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 7297af467b..d61585df5b 100644 --- a/commit.h +++ b/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 * 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_the_repository(const struct commit *, unsigned long *size); +const void *get_cached_commit_buffer(struct repository *, const struct commit *, unsigned long *size); /* * Get the commit's object contents, either from cache or by reading the object -- cgit v1.2.3 From d9a05e74ec01bb59fccb70c005269d930cd60d9a Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:21 -0700 Subject: commit.c: allow lookup_commit_reference_gently to handle arbitrary repositories Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index d61585df5b..f1f25957de 100644 --- a/commit.h +++ b/commit.h @@ -67,9 +67,7 @@ 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_gently(r, o, q) \ - lookup_commit_reference_gently_##r(o, q) -struct commit *lookup_commit_reference_gently_the_repository( +struct commit *lookup_commit_reference_gently(struct repository *r, const struct object_id *oid, int quiet); struct commit *lookup_commit_reference_by_name(const char *name); -- cgit v1.2.3 From 1f6c72fe55fded90cadcefffe5bd980a6f896579 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 28 Jun 2018 18:22:22 -0700 Subject: commit.c: allow lookup_commit_reference to handle arbitrary repositories Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index f1f25957de..8b2cf9692d 100644 --- a/commit.h +++ b/commit.h @@ -64,9 +64,8 @@ void add_name_decoration(enum decoration_type type, const char *name, struct obj const struct name_decoration *get_name_decoration(const struct object *obj); 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); +struct commit *lookup_commit_reference(struct repository *r, + const struct object_id *oid); struct commit *lookup_commit_reference_gently(struct repository *r, const struct object_id *oid, int quiet); -- cgit v1.2.3