Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1ce9ea3b
Commit
1ce9ea3b
authored
Jan 15, 2015
by
Edward Thomson
Committed by
Edward Thomson
Jan 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkout tests: cleanup realpath impl on Win32
parent
f9df7b62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
36 deletions
+6
-36
tests/checkout/icase.c
+6
-36
No files found.
tests/checkout/icase.c
View file @
1ce9ea3b
...
@@ -30,51 +30,21 @@ void test_checkout_icase__cleanup(void)
...
@@ -30,51 +30,21 @@ void test_checkout_icase__cleanup(void)
cl_git_sandbox_cleanup
();
cl_git_sandbox_cleanup
();
}
}
static
char
*
p
_realpath
(
const
char
*
in
)
static
char
*
test
_realpath
(
const
char
*
in
)
{
{
#ifdef GIT_WIN32
#ifdef GIT_WIN32
/*
HANDLE fh, mh;
HINSTANCE psapi;
BY_HANDLE_FILE_INFORMATION fi;
void *map;
char *filename;
size_t filename_len = 1024;
typedef DWORD (__stdcall *getmappedfilename)(HANDLE, LPVOID, LPTSTR, DWORD);
getmappedfilename getfunc;
cl_assert(filename = malloc(filename_len));
cl_win32_pass(psapi = LoadLibrary("psapi.dll"));
cl_win32_pass(getfunc = (getmappedfilename)GetProcAddress(psapi, "GetMappedFileNameA"));
cl_win32_pass(fh = CreateFileA(in, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL));
cl_win32_pass(mh = CreateFileMapping(fh, NULL, PAGE_READONLY, 0, 1, NULL));
cl_win32_pass(map = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, 1));
cl_win32_pass(getfunc(GetCurrentProcess(), map, filename, filename_len));
UnmapViewOfFile(map);
CloseHandle(mh);
CloseHandle(fh);
*/
HANDLE
fh
;
HANDLE
fh
;
H
INSTANC
E
kerneldll
;
H
MODUL
E
kerneldll
;
char
*
filename
;
char
*
filename
;
typedef
DWORD
(
__stdcall
*
getfinalpathname
)(
HANDLE
,
LPSTR
,
DWORD
,
DWORD
);
typedef
DWORD
(
__stdcall
*
getfinalpathname
)(
HANDLE
,
LPSTR
,
DWORD
,
DWORD
);
getfinalpathname
getfinalpathfn
;
getfinalpathname
getfinalpathfn
;
cl_assert
(
filename
=
malloc
(
MAX_PATH
));
cl_assert
(
filename
=
malloc
(
MAX_PATH
));
cl_
win32_pass
(
kerneldll
=
LoadLibrary
(
"kernel32.dll"
));
cl_
assert
(
kerneldll
=
LoadLibrary
(
"kernel32.dll"
));
cl_
win32_pass
(
getfinalpathfn
=
(
getfinalpathname
)
GetProcAddress
(
kerneldll
,
"GetFinalPathNameByHandleA"
));
cl_
assert
(
getfinalpathfn
=
(
getfinalpathname
)
GetProcAddress
(
kerneldll
,
"GetFinalPathNameByHandleA"
));
cl_
win32_pass
(
fh
=
CreateFileA
(
in
,
FILE_READ_ATTRIBUTES
|
STANDARD_RIGHTS_READ
,
FILE_SHARE_READ
,
cl_
assert
(
fh
=
CreateFileA
(
in
,
FILE_READ_ATTRIBUTES
|
STANDARD_RIGHTS_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
));
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
));
cl_win32_pass
(
getfinalpathfn
(
fh
,
filename
,
MAX_PATH
,
VOLUME_NAME_DOS
));
cl_win32_pass
(
getfinalpathfn
(
fh
,
filename
,
MAX_PATH
,
VOLUME_NAME_DOS
));
...
@@ -94,7 +64,7 @@ static void assert_name_is(const char *expected)
...
@@ -94,7 +64,7 @@ static void assert_name_is(const char *expected)
char
*
actual
;
char
*
actual
;
size_t
actual_len
,
expected_len
,
start
;
size_t
actual_len
,
expected_len
,
start
;
cl_assert
(
actual
=
p
_realpath
(
expected
));
cl_assert
(
actual
=
test
_realpath
(
expected
));
expected_len
=
strlen
(
expected
);
expected_len
=
strlen
(
expected
);
actual_len
=
strlen
(
actual
);
actual_len
=
strlen
(
actual
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment