From 3f5787f80662b8f5dbd6fb83d5ca20be224e8a08 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Tue, 15 May 2018 16:42:18 -0700 Subject: commit: add repository argument to register_commit_graft Add a repository argument to allow callers of register_commit_graft 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: 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 2d764ab7d8..40a5b5e258 100644 --- a/commit.h +++ b/commit.h @@ -174,7 +174,8 @@ struct commit_graft { typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *); struct commit_graft *read_graft_line(struct strbuf *line); -int register_commit_graft(struct commit_graft *, int); +#define register_commit_graft(r, g, i) register_commit_graft_##r(g, i) +int register_commit_graft_the_repository(struct commit_graft *, int); struct commit_graft *lookup_commit_graft(const struct object_id *oid); extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2); -- cgit v1.2.3 From 1f93ecd1ab15800fa98a0ce3efa5166fa642ab80 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Thu, 17 May 2018 15:51:42 -0700 Subject: commit: add repository argument to lookup_commit_graft Add a repository argument to allow callers of lookup_commit_graft 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: 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 40a5b5e258..f674612576 100644 --- a/commit.h +++ b/commit.h @@ -176,7 +176,8 @@ typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *); struct commit_graft *read_graft_line(struct strbuf *line); #define register_commit_graft(r, g, i) register_commit_graft_##r(g, i) int register_commit_graft_the_repository(struct commit_graft *, int); -struct commit_graft *lookup_commit_graft(const struct object_id *oid); +#define lookup_commit_graft(r, o) lookup_commit_graft_##r(o) +struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid); extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2); extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos); -- cgit v1.2.3 From 6a2df51c848c86e5620dcdf1a0ee2de637937b77 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 17 May 2018 15:51:43 -0700 Subject: shallow: add repository argument to set_alternate_shallow_file Add a repository argument to allow callers of set_alternate_shallow_file 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 f674612576..f88c854e2f 100644 --- a/commit.h +++ b/commit.h @@ -199,7 +199,8 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag); extern struct commit_list *get_shallow_commits_by_rev_list( int ac, const char **av, int shallow_flag, int not_shallow_flag); -extern void set_alternate_shallow_file(const char *path, int override); +#define set_alternate_shallow_file(r, p, o) set_alternate_shallow_file_##r(p, o) +extern void set_alternate_shallow_file_the_repository(const char *path, int override); extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol, const struct oid_array *extra); extern void setup_alternate_shallow(struct lock_file *shallow_lock, -- cgit v1.2.3 From 19143f139d5a1a821d9d066da5d1c136a53ed803 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 17 May 2018 15:51:44 -0700 Subject: shallow: add repository argument to register_shallow Add a repository argument to allow callers of register_shallow 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 f88c854e2f..59346de551 100644 --- a/commit.h +++ b/commit.h @@ -191,7 +191,8 @@ extern struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct oid_array; struct ref; -extern int register_shallow(const struct object_id *oid); +#define register_shallow(r, o) register_shallow_##r(o); +extern int register_shallow_the_repository(const struct object_id *oid); extern int unregister_shallow(const struct object_id *oid); extern int for_each_commit_graft(each_commit_graft_fn, void *); extern int is_repository_shallow(void); -- cgit v1.2.3 From c88134870e8b2da084e37fb86ff88fb7d7617d61 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 17 May 2018 15:51:46 -0700 Subject: shallow: add repository argument to is_repository_shallow Add a repository argument to allow callers of is_repository_shallow 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 59346de551..c7f25d6490 100644 --- a/commit.h +++ b/commit.h @@ -195,7 +195,8 @@ struct ref; extern int register_shallow_the_repository(const struct object_id *oid); extern int unregister_shallow(const struct object_id *oid); extern int for_each_commit_graft(each_commit_graft_fn, void *); -extern int is_repository_shallow(void); +#define is_repository_shallow(r) is_repository_shallow_##r() +extern int is_repository_shallow_the_repository(void); extern struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag); extern struct commit_list *get_shallow_commits_by_rev_list( -- cgit v1.2.3 From a3b78e833b06f4bfdef8c4d70d4d269226bebd09 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 17 May 2018 15:51:48 -0700 Subject: commit: convert register_commit_graft to handle arbitrary repositories Signed-off-by: Brandon Williams 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 c7f25d6490..d04bbed81c 100644 --- a/commit.h +++ b/commit.h @@ -174,8 +174,7 @@ struct commit_graft { typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *); struct commit_graft *read_graft_line(struct strbuf *line); -#define register_commit_graft(r, g, i) register_commit_graft_##r(g, i) -int register_commit_graft_the_repository(struct commit_graft *, int); +int register_commit_graft(struct repository *r, struct commit_graft *, int); #define lookup_commit_graft(r, o) lookup_commit_graft_##r(o) struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid); -- cgit v1.2.3 From eee4502baaf8f82c20bcda70625df56ce68dd9b1 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 17 May 2018 15:51:52 -0700 Subject: shallow: migrate shallow information into the object parser We need to convert the shallow functions all at the same time as we move the data structures they operate on into the repository. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- commit.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index d04bbed81c..45114a95b2 100644 --- a/commit.h +++ b/commit.h @@ -190,18 +190,15 @@ extern struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct oid_array; struct ref; -#define register_shallow(r, o) register_shallow_##r(o); -extern int register_shallow_the_repository(const struct object_id *oid); +extern int register_shallow(struct repository *r, const struct object_id *oid); extern int unregister_shallow(const struct object_id *oid); extern int for_each_commit_graft(each_commit_graft_fn, void *); -#define is_repository_shallow(r) is_repository_shallow_##r() -extern int is_repository_shallow_the_repository(void); +extern int is_repository_shallow(struct repository *r); extern struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag); extern struct commit_list *get_shallow_commits_by_rev_list( int ac, const char **av, int shallow_flag, int not_shallow_flag); -#define set_alternate_shallow_file(r, p, o) set_alternate_shallow_file_##r(p, o) -extern void set_alternate_shallow_file_the_repository(const char *path, int override); +extern void set_alternate_shallow_file(struct repository *r, const char *path, int override); extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol, const struct oid_array *extra); extern void setup_alternate_shallow(struct lock_file *shallow_lock, -- cgit v1.2.3 From b9dbddf6dace2094061d5093743f29c100cfd534 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 17 May 2018 15:51:54 -0700 Subject: commit: allow lookup_commit_graft 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 45114a95b2..6de6f10cd0 100644 --- a/commit.h +++ b/commit.h @@ -175,8 +175,7 @@ typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *); struct commit_graft *read_graft_line(struct strbuf *line); int register_commit_graft(struct repository *r, struct commit_graft *, int); -#define lookup_commit_graft(r, o) lookup_commit_graft_##r(o) -struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid); +struct commit_graft *lookup_commit_graft(struct repository *r, const struct object_id *oid); extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2); extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos); -- cgit v1.2.3