Commit 07c989e9 by Edward Thomson

win32: further cleanups for 8.3 disabling

parent 5f28ec84
...@@ -217,12 +217,9 @@ void test_checkout_nasty__git_tilde1(void) ...@@ -217,12 +217,9 @@ void test_checkout_nasty__git_tilde1(void)
void test_checkout_nasty__git_custom_shortname(void) void test_checkout_nasty__git_custom_shortname(void)
{ {
#ifdef GIT_WIN32 #ifdef GIT_WIN32
char *shortname = git_win32_path_8dot3_name("C:\\Program Files"); if (!cl_sandbox_supports_8dot3())
if (shortname == NULL)
clar__skip(); clar__skip();
git__free(shortname);
cl_must_pass(p_rename("nasty/.git", "nasty/_temp")); cl_must_pass(p_rename("nasty/.git", "nasty/_temp"));
cl_git_write2file("nasty/git~1", "", 0, O_RDWR|O_CREAT, 0666); cl_git_write2file("nasty/git~1", "", 0, O_RDWR|O_CREAT, 0666);
cl_must_pass(p_rename("nasty/_temp", "nasty/.git")); cl_must_pass(p_rename("nasty/_temp", "nasty/.git"));
......
...@@ -538,3 +538,25 @@ void cl_sandbox_set_search_path_defaults(void) ...@@ -538,3 +538,25 @@ void cl_sandbox_set_search_path_defaults(void)
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, sandbox_path); GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, sandbox_path);
} }
#ifdef GIT_WIN32
bool cl_sandbox_supports_8dot3(void)
{
git_buf longpath = GIT_BUF_INIT;
char *shortname;
bool supported;
cl_git_pass(
git_buf_joinpath(&longpath, clar_sandbox_path(), "longer_than_8dot3"));
cl_git_write2file(longpath.ptr, "", 0, O_RDWR|O_CREAT, 0666);
shortname = git_win32_path_8dot3_name(longpath.ptr);
supported = (shortname != NULL);
git__free(shortname);
git_buf_free(&longpath);
return supported;
}
#endif
...@@ -161,4 +161,8 @@ void cl_fake_home_cleanup(void *); ...@@ -161,4 +161,8 @@ void cl_fake_home_cleanup(void *);
void cl_sandbox_set_search_path_defaults(void); void cl_sandbox_set_search_path_defaults(void);
#ifdef GIT_WIN32
bool cl_sandbox_supports_8dot3(void);
#endif
#endif #endif
...@@ -194,13 +194,11 @@ void test_path_win32__8dot3_name(void) ...@@ -194,13 +194,11 @@ void test_path_win32__8dot3_name(void)
#ifdef GIT_WIN32 #ifdef GIT_WIN32
char *shortname; char *shortname;
/* Some guaranteed short names */ if (!cl_sandbox_supports_8dot3())
shortname = git_win32_path_8dot3_name("C:\\Program Files");
if (shortname == NULL)
clar__skip(); clar__skip();
cl_assert_equal_s("PROGRA~1", shortname); /* Some guaranteed short names */
cl_assert_equal_s("PROGRA~1", (shortname = git_win32_path_8dot3_name("C:\\Program Files")));
git__free(shortname); git__free(shortname);
cl_assert_equal_s("WINDOWS", (shortname = git_win32_path_8dot3_name("C:\\WINDOWS"))); cl_assert_equal_s("WINDOWS", (shortname = git_win32_path_8dot3_name("C:\\WINDOWS")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment