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
df297a1f
Commit
df297a1f
authored
Sep 16, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Clay compilation under Win32
parent
48e97ed1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
tests-clay/clay_main.c
+21
-10
tests-clay/status/single.c
+1
-1
tests-clay/status/worktree.c
+1
-1
No files found.
tests-clay/clay_main.c
View file @
df297a1f
...
@@ -23,19 +23,25 @@
...
@@ -23,19 +23,25 @@
#ifdef _WIN32
#ifdef _WIN32
# include <windows.h>
# include <windows.h>
# include <io.h>
# include <io.h>
# include <Shellapi.h>
# include <shellapi.h>
# include <direct.h>
# pragma comment(lib, "shell32")
# pragma comment(lib, "shell32")
# define _CC __cdecl
# define stat(path, st) _stat(path, st)
# define stat(path, st) _stat(path, st)
# define mkdir(path, mode) _mkdir(path)
# define mkdir(path, mode) _mkdir(path)
# define chdir(path) _chdir(path)
# define access(path, mode) _access(path, mode)
# define access(path, mode) _access(path, mode)
# define mktemp(path) _mktemp(path)
# define strdup(str) _strdup(str)
# define strncpy(to, from, to_size) strncpy_s(to, to_size, from, _TRUNCATE)
# define W_OK 02
# define W_OK 02
# define S_ISDIR(x) (
x & _S_IFDIR) != 0
# define S_ISDIR(x) (
(x & _S_IFDIR) != 0)
typedef
struct
_stat
STAT_T
;
typedef
struct
_stat
STAT_T
;
#else
#else
# include <unistd.h>
# include <unistd.h>
# define _CC
typedef
struct
stat
STAT_T
;
typedef
struct
stat
STAT_T
;
#endif
#endif
...
@@ -373,12 +379,11 @@ find_tmp_path(char *buffer, size_t length)
...
@@ -373,12 +379,11 @@ find_tmp_path(char *buffer, size_t length)
"TMPDIR"
,
"TMP"
,
"TEMP"
,
"USERPROFILE"
"TMPDIR"
,
"TMP"
,
"TEMP"
,
"USERPROFILE"
};
};
size_t
i
;
#ifdef _WIN32
#ifdef _WIN32
if
(
GetTempPath
((
DWORD
)
length
,
buffer
))
if
(
GetTempPath
((
DWORD
)
length
,
buffer
))
return
0
;
return
0
;
#endif
#else
size_t
i
;
for
(
i
=
0
;
i
<
var_count
;
++
i
)
{
for
(
i
=
0
;
i
<
var_count
;
++
i
)
{
const
char
*
env
=
getenv
(
env_vars
[
i
]);
const
char
*
env
=
getenv
(
env_vars
[
i
]);
...
@@ -396,6 +401,7 @@ find_tmp_path(char *buffer, size_t length)
...
@@ -396,6 +401,7 @@ find_tmp_path(char *buffer, size_t length)
strncpy
(
buffer
,
"/tmp"
,
length
);
strncpy
(
buffer
,
"/tmp"
,
length
);
return
0
;
return
0
;
}
}
#endif
/* This system doesn't like us, try to use the current directory */
/* This system doesn't like us, try to use the current directory */
if
(
is_valid_tmp_path
(
"."
))
{
if
(
is_valid_tmp_path
(
"."
))
{
...
@@ -442,10 +448,15 @@ static int build_sandbox_path(void)
...
@@ -442,10 +448,15 @@ static int build_sandbox_path(void)
_clay_path
[
len
++
]
=
'/'
;
_clay_path
[
len
++
]
=
'/'
;
}
}
str
cpy
(
_clay_path
+
len
,
path_tail
);
str
ncpy
(
_clay_path
+
len
,
path_tail
,
sizeof
(
_clay_path
)
-
len
);
#ifdef _WIN32
if
(
_mktemp_s
(
_clay_path
,
sizeof
(
_clay_path
))
!=
0
)
return
-
1
;
#else
if
(
mktemp
(
_clay_path
)
==
NULL
)
if
(
mktemp
(
_clay_path
)
==
NULL
)
return
-
1
;
return
-
1
;
#endif
return
0
;
return
0
;
}
}
...
@@ -673,9 +684,9 @@ extern void test_core_string__1(void);
...
@@ -673,9 +684,9 @@ extern void test_core_string__1(void);
extern
void
test_core_vector__0
(
void
);
extern
void
test_core_vector__0
(
void
);
extern
void
test_core_vector__1
(
void
);
extern
void
test_core_vector__1
(
void
);
extern
void
test_core_vector__2
(
void
);
extern
void
test_core_vector__2
(
void
);
extern
void
test_status_single__hash_single_file
();
extern
void
test_status_single__hash_single_file
(
void
);
extern
void
test_status_worktree__initialize
(
void
);
extern
void
test_status_worktree__initialize
(
void
);
extern
void
test_status_worktree__cleanup
();
extern
void
test_status_worktree__cleanup
(
void
);
extern
void
test_status_worktree__whole_repository
(
void
);
extern
void
test_status_worktree__whole_repository
(
void
);
extern
void
test_status_worktree__empty_repository
(
void
);
extern
void
test_status_worktree__empty_repository
(
void
);
...
@@ -758,7 +769,7 @@ static const struct clay_suite _all_suites[] = {
...
@@ -758,7 +769,7 @@ static const struct clay_suite _all_suites[] = {
static
const
char
_suites_str
[]
=
"core::dirent, core::filebuf, core::path, core::rmdir, core::string, core::vector, status::single, status::worktree"
;
static
const
char
_suites_str
[]
=
"core::dirent, core::filebuf, core::path, core::rmdir, core::string, core::vector, status::single, status::worktree"
;
int
main
(
int
argc
,
char
*
argv
[])
int
_CC
main
(
int
argc
,
char
*
argv
[])
{
{
return
clay_test
(
return
clay_test
(
argc
,
argv
,
_suites_str
,
argc
,
argv
,
_suites_str
,
...
...
tests-clay/status/single.c
View file @
df297a1f
...
@@ -17,7 +17,7 @@ file_create(const char *filename, const char *content)
...
@@ -17,7 +17,7 @@ file_create(const char *filename, const char *content)
}
}
/* test retrieving OID from a file apart from the ODB */
/* test retrieving OID from a file apart from the ODB */
void
test_status_single__hash_single_file
()
void
test_status_single__hash_single_file
(
void
)
{
{
static
const
char
file_name
[]
=
"new_file"
;
static
const
char
file_name
[]
=
"new_file"
;
static
const
char
file_contents
[]
=
"new_file
\n
"
;
static
const
char
file_contents
[]
=
"new_file
\n
"
;
...
...
tests-clay/status/worktree.c
View file @
df297a1f
...
@@ -86,7 +86,7 @@ void test_status_worktree__initialize(void)
...
@@ -86,7 +86,7 @@ void test_status_worktree__initialize(void)
* This will be called once after each test finishes, even
* This will be called once after each test finishes, even
* if the test failed
* if the test failed
*/
*/
void
test_status_worktree__cleanup
()
void
test_status_worktree__cleanup
(
void
)
{
{
git_repository_free
(
_repository
);
git_repository_free
(
_repository
);
_repository
=
NULL
;
_repository
=
NULL
;
...
...
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