From ded77bb1f18c6cb7a0371b3f66c92387413a161d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sat, 29 Jun 2019 09:58:34 +0200 Subject: path: extract function to check whether a path supports symlinks When initializing a repository, we need to check whether its working directory supports symlinks to correctly set the initial value of the "core.symlinks" config variable. The code to check the filesystem is reusable in other parts of our codebase, like for example in our tests to determine whether certain tests can be expected to succeed or not. Extract the code into a new function `git_path_supports_symlinks` to avoid duplicate implementations. Remove a duplicate implementation in the repo test helper code. --- tests/checkout/index.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/checkout/index.c') diff --git a/tests/checkout/index.c b/tests/checkout/index.c index dcacdd5d3..a76c471e8 100644 --- a/tests/checkout/index.c +++ b/tests/checkout/index.c @@ -181,7 +181,7 @@ void test_checkout_index__honor_coresymlinks_default_true(void) cl_must_pass(p_mkdir("symlink", 0777)); - if (!filesystem_supports_symlinks("symlink/test")) + if (!git_path_supports_symlinks("symlink/test")) cl_skip(); #ifdef GIT_WIN32 @@ -214,7 +214,7 @@ void test_checkout_index__honor_coresymlinks_default_false(void) * supports symlinks. Bail entirely on POSIX platforms that * do support symlinks. */ - if (filesystem_supports_symlinks("symlink/test")) + if (git_path_supports_symlinks("symlink/test")) cl_skip(); #endif @@ -226,7 +226,7 @@ void test_checkout_index__coresymlinks_set_to_true_fails_when_unsupported(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - if (filesystem_supports_symlinks("testrepo/test")) { + if (git_path_supports_symlinks("testrepo/test")) { cl_skip(); } @@ -242,7 +242,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void) char link_data[GIT_PATH_MAX]; size_t link_size = GIT_PATH_MAX; - if (!filesystem_supports_symlinks("testrepo/test")) { + if (!git_path_supports_symlinks("testrepo/test")) { cl_skip(); } -- cgit v1.2.1