diff options
-rw-r--r-- | promisor-remote.c | 3 | ||||
-rw-r--r-- | promisor-remote.h | 14 | ||||
-rwxr-xr-x | t/t0410-partial-clone.sh | 13 |
3 files changed, 23 insertions, 7 deletions
diff --git a/promisor-remote.c b/promisor-remote.c index 9bc296cdde..9bd5b79d59 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -89,6 +89,9 @@ static struct promisor_remote *promisor_remote_lookup(const char *remote_name, static void promisor_remote_move_to_tail(struct promisor_remote *r, struct promisor_remote *previous) { + if (r->next == NULL) + return; + if (previous) previous->next = r->next; else diff --git a/promisor-remote.h b/promisor-remote.h index 8200dfc940..c60aaa5cce 100644 --- a/promisor-remote.h +++ b/promisor-remote.h @@ -15,17 +15,17 @@ struct promisor_remote { const char name[FLEX_ARRAY]; }; -extern void promisor_remote_reinit(void); -extern struct promisor_remote *promisor_remote_find(const char *remote_name); -extern int has_promisor_remote(void); -extern int promisor_remote_get_direct(struct repository *repo, - const struct object_id *oids, - int oid_nr); +void promisor_remote_reinit(void); +struct promisor_remote *promisor_remote_find(const char *remote_name); +int has_promisor_remote(void); +int promisor_remote_get_direct(struct repository *repo, + const struct object_id *oids, + int oid_nr); /* * This should be used only once from setup.c to set the value we got * from the extensions.partialclone config option. */ -extern void set_repository_format_partial_clone(char *partial_clone); +void set_repository_format_partial_clone(char *partial_clone); #endif /* PROMISOR_REMOTE_H */ diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh index 1e389c049a..a3988bd4b8 100755 --- a/t/t0410-partial-clone.sh +++ b/t/t0410-partial-clone.sh @@ -429,6 +429,19 @@ test_expect_success 'rev-list dies for missing objects on cmd line' ' done ' +test_expect_success 'single promisor remote can be re-initialized gracefully' ' + # ensure one promisor is in the promisors list + rm -rf repo && + test_create_repo repo && + test_create_repo other && + git -C repo remote add foo "file://$(pwd)/other" && + git -C repo config remote.foo.promisor true && + git -C repo config extensions.partialclone foo && + + # reinitialize the promisors list + git -C repo fetch --filter=blob:none foo +' + test_expect_success 'gc repacks promisor objects separately from non-promisor objects' ' rm -rf repo && test_create_repo repo && |