summaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-12-01 13:09:58 -0500
committerEdward Thomson <ethomson@microsoft.com>2014-12-16 10:08:43 -0600
commitcceae9a25d0bed8b00f4981e051d5f380ef54401 (patch)
tree37fc849d60ba24f6c6ac896322d6e8ac5f7d902c /tests/core
parent09debe1213b9c979e21106ccbe9d420f8511f4eb (diff)
downloadlibgit2-cceae9a25d0bed8b00f4981e051d5f380ef54401.tar.gz
win32: use NT-prefixed "\\?\" paths
When turning UTF-8 paths into UCS-2 paths for Windows, always use the \\?\-prefixed paths. Because this bypasses the system's path canonicalization, handle the canonicalization functions ourselves. We must: 1. always use a backslash as a directory separator 2. only use a single backslash between directories 3. not rely on the system to translate "." and ".." in paths 4. remove trailing backslashes, except at the drive root (C:\)
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/link.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/tests/core/link.c b/tests/core/link.c
index 83999ebdf..ec85ec4e0 100644
--- a/tests/core/link.c
+++ b/tests/core/link.c
@@ -197,19 +197,6 @@ static void do_custom_reparse(const char *path)
#endif
-git_buf *unslashify(git_buf *buf)
-{
-#ifdef GIT_WIN32
- size_t i;
-
- for (i = 0; i < buf->size; i++)
- if (buf->ptr[i] == '/')
- buf->ptr[i] = '\\';
-#endif
-
- return buf;
-}
-
void test_core_link__stat_regular_file(void)
{
struct stat st;
@@ -584,7 +571,7 @@ void test_core_link__readlink_symlink(void)
buf[len] = 0;
- cl_assert_equal_s(git_buf_cstr(unslashify(&target_path)), buf);
+ cl_assert_equal_s(git_buf_cstr(&target_path), buf);
git_buf_free(&target_path);
}
@@ -607,7 +594,7 @@ void test_core_link__readlink_dangling(void)
buf[len] = 0;
- cl_assert_equal_s(git_buf_cstr(unslashify(&target_path)), buf);
+ cl_assert_equal_s(git_buf_cstr(&target_path), buf);
git_buf_free(&target_path);
}
@@ -636,7 +623,7 @@ void test_core_link__readlink_multiple(void)
buf[len] = 0;
- cl_assert_equal_s(git_buf_cstr(unslashify(&path2)), buf);
+ cl_assert_equal_s(git_buf_cstr(&path2), buf);
git_buf_free(&path1);
git_buf_free(&path2);