diff --git a/src/shared/delete.c b/src/shared/delete.c index 3e4fb62..a47cc3b 100644 --- a/src/shared/delete.c +++ b/src/shared/delete.c @@ -550,7 +550,7 @@ bool delete_extras(const char* dest_root, const ArrayList* manifest) { its root-relative form, and one outside the root returns NULL (the walk cannot reach it, and it is not protected data beneath the root). Exposed so tests can exercise the root-of-"/" child mapping directly. */ -char* file_receive_basis_delete_relative(const Config* config, const char* path) { +char* delete_basis_relative(const Config* config, const char* path) { if (!path) return NULL; if (path[0] != '/') @@ -616,7 +616,7 @@ bool delete_skips_build(const Config* config, const ArrayList* protected_paths, if (basis_root_relative) { /* An absolute basis outside the receive root is unreachable by this walk, so it contributes no protection prefix (and no slot). */ - char* relative = file_receive_basis_delete_relative(config, config->basis_dirs[i].path); + char* relative = delete_basis_relative(config, config->basis_dirs[i].path); if (!relative) continue; out->owned_prefixes[i] = relative; diff --git a/src/shared/delete.h b/src/shared/delete.h index 235db8c..f0921a1 100644 --- a/src/shared/delete.h +++ b/src/shared/delete.h @@ -146,6 +146,6 @@ void delete_skips_free(DeleteSkipSet* set); /* Convert one basis-directory path to the receive-root-relative protection prefix the delete walker uses (NULL when it lies outside the root). Exposed for unit tests of the root-of-"/" and normalization edge cases. */ -char* file_receive_basis_delete_relative(const Config* config, const char* path); +char* delete_basis_relative(const Config* config, const char* path); #endif diff --git a/tests/test_file.c b/tests/test_file.c index 69912f0..efb87a7 100644 --- a/tests/test_file.c +++ b/tests/test_file.c @@ -2255,26 +2255,26 @@ static void test_basis_delete_relative_root_slash() { EXPECT_NOT_NULL(cfg); cfg->receive_root_directory = str_dup("/"); - char* rel = file_receive_basis_delete_relative(cfg, "/a"); + char* rel = delete_basis_relative(cfg, "/a"); EXPECT_NOT_NULL(rel); EXPECT_EQ_STR(rel, "a"); free(rel); - rel = file_receive_basis_delete_relative(cfg, "/a/b"); + rel = delete_basis_relative(cfg, "/a/b"); EXPECT_NOT_NULL(rel); EXPECT_EQ_STR(rel, "a/b"); free(rel); /* The root itself is not a child. */ - EXPECT_NULL(file_receive_basis_delete_relative(cfg, "/")); + EXPECT_NULL(delete_basis_relative(cfg, "/")); /* A relative entry is already root-relative. */ - rel = file_receive_basis_delete_relative(cfg, "x/y"); + rel = delete_basis_relative(cfg, "x/y"); EXPECT_NOT_NULL(rel); EXPECT_EQ_STR(rel, "x/y"); free(rel); /* An absolute path outside a non-"/" root is unreachable. */ free(cfg->receive_root_directory); cfg->receive_root_directory = str_dup("/root"); - EXPECT_NULL(file_receive_basis_delete_relative(cfg, "/other/a")); - rel = file_receive_basis_delete_relative(cfg, "/root/a"); + EXPECT_NULL(delete_basis_relative(cfg, "/other/a")); + rel = delete_basis_relative(cfg, "/root/a"); EXPECT_NOT_NULL(rel); EXPECT_EQ_STR(rel, "a"); free(rel);