In the last commit, we introduced a header for the functions defined in 'shallow.c'. There is one remaining shallow-related function in commit.c which should be moved, too. This patch moves that function. Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- commit.c | 13 ------------- shallow.c | 13 +++++++++++++ shallow.h | 1 + 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/commit.c b/commit.c index eebfbeb45d..87686a7055 100644 --- a/commit.c +++ b/commit.c @@ -246,19 +246,6 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data) return ret; } -int unregister_shallow(const struct object_id *oid) -{ - int pos = commit_graft_pos(the_repository, oid->hash); - if (pos < 0) - return -1; - if (pos + 1 < the_repository->parsed_objects->grafts_nr) - MOVE_ARRAY(the_repository->parsed_objects->grafts + pos, - the_repository->parsed_objects->grafts + pos + 1, - the_repository->parsed_objects->grafts_nr - pos - 1); - the_repository->parsed_objects->grafts_nr--; - return 0; -} - struct commit_buffer { void *buffer; unsigned long size; diff --git a/shallow.c b/shallow.c index d0191c7609..76e00893fe 100644 --- a/shallow.c +++ b/shallow.c @@ -39,6 +39,19 @@ int register_shallow(struct repository *r, const struct object_id *oid) return register_commit_graft(r, graft, 0); } +int unregister_shallow(const struct object_id *oid) +{ + int pos = commit_graft_pos(the_repository, oid->hash); + if (pos < 0) + return -1; + if (pos + 1 < the_repository->parsed_objects->grafts_nr) + MOVE_ARRAY(the_repository->parsed_objects->grafts + pos, + the_repository->parsed_objects->grafts + pos + 1, + the_repository->parsed_objects->grafts_nr - pos - 1); + the_repository->parsed_objects->grafts_nr--; + return 0; +} + int is_repository_shallow(struct repository *r) { FILE *fp; diff --git a/shallow.h b/shallow.h index 14dd748625..b50a85ed7e 100644 --- a/shallow.h +++ b/shallow.h @@ -8,6 +8,7 @@ void set_alternate_shallow_file(struct repository *r, const char *path, int override); int register_shallow(struct repository *r, const struct object_id *oid); +int unregister_shallow(const struct object_id *oid); int is_repository_shallow(struct repository *r); int commit_shallow_file(struct repository *r, struct lock_file *lk); void rollback_shallow_file(struct repository *r, struct lock_file *lk); -- 2.26.0.113.ge9739cdccc