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
9cde607c
Commit
9cde607c
authored
May 24, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up system file finding tests on Win32
parent
349fb6d7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
19 deletions
+10
-19
src/fileops.c
+0
-0
tests-clar/core/env.c
+10
-19
No files found.
src/fileops.c
View file @
9cde607c
tests-clar/core/env.c
View file @
9cde607c
...
@@ -53,26 +53,24 @@ static int cl_setenv(const char *name, const char *value)
...
@@ -53,26 +53,24 @@ static int cl_setenv(const char *name, const char *value)
#endif
#endif
static
char
*
env_home
=
NULL
;
static
char
*
env_home
=
NULL
;
#ifdef GIT_WIN32
static
char
*
env_userprofile
=
NULL
;
static
char
*
env_userprofile
=
NULL
;
#endif
void
test_core_env__initialize
(
void
)
void
test_core_env__initialize
(
void
)
{
{
env_home
=
cl_getenv
(
"HOME"
);
#ifdef GIT_WIN32
#ifdef GIT_WIN32
env_userprofile
=
cl_getenv
(
"USERPROFILE"
);
env_userprofile
=
cl_getenv
(
"USERPROFILE"
);
#else
env_home
=
cl_getenv
(
"HOME"
);
#endif
#endif
}
}
void
test_core_env__cleanup
(
void
)
void
test_core_env__cleanup
(
void
)
{
{
cl_setenv
(
"HOME"
,
env_home
);
#ifdef GIT_WIN32
#ifdef GIT_WIN32
cl_setenv
(
"USERPROFILE"
,
env_userprofile
);
cl_setenv
(
"USERPROFILE"
,
env_userprofile
);
git__free
(
env_home
);
git__free
(
env_userprofile
);
git__free
(
env_userprofile
);
#else
cl_setenv
(
"HOME"
,
env_home
);
#endif
#endif
}
}
...
@@ -102,32 +100,25 @@ void test_core_env__0(void)
...
@@ -102,32 +100,25 @@ void test_core_env__0(void)
*/
*/
cl_git_pass
(
git_path_prettify
(
&
path
,
*
val
,
NULL
));
cl_git_pass
(
git_path_prettify
(
&
path
,
*
val
,
NULL
));
cl_git_pass
(
cl_setenv
(
"HOME"
,
path
.
ptr
));
/* do a quick check that it was set correctly */
check
=
cl_getenv
(
"HOME"
);
cl_assert_equal_s
(
path
.
ptr
,
check
);
#ifdef GIT_WIN32
#ifdef GIT_WIN32
git__free
(
check
);
cl_git_pass
(
cl_setenv
(
"USERPROFILE"
,
path
.
ptr
));
cl_git_pass
(
cl_setenv
(
"USERPROFILE"
,
path
.
ptr
));
/* do a quick check that it was set correctly */
/* do a quick check that it was set correctly */
check
=
cl_getenv
(
"USERPROFILE"
);
check
=
cl_getenv
(
"USERPROFILE"
);
cl_assert_equal_s
(
path
.
ptr
,
check
);
cl_assert_equal_s
(
path
.
ptr
,
check
);
git__free
(
check
);
git__free
(
check
);
#else
cl_git_pass
(
cl_setenv
(
"HOME"
,
path
.
ptr
));
/* do a quick check that it was set correctly */
check
=
cl_getenv
(
"HOME"
);
cl_assert_equal_s
(
path
.
ptr
,
check
);
#endif
#endif
cl_git_pass
(
git_buf_puts
(
&
path
,
"/testfile"
));
cl_git_pass
(
git_buf_puts
(
&
path
,
"/testfile"
));
cl_git_mkfile
(
path
.
ptr
,
"find me"
);
cl_git_mkfile
(
path
.
ptr
,
"find me"
);
cl_git_pass
(
git_futils_find_global_file
(
&
found
,
"testfile"
));
cl_git_pass
(
git_futils_find_global_file
(
&
found
,
"testfile"
));
#ifdef GIT_WIN32
/* do another check with HOME unset */
cl_git_pass
(
cl_setenv
(
"HOME"
,
NULL
));
cl_git_pass
(
git_futils_find_global_file
(
&
found
,
"testfile"
));
#endif
}
}
}
}
...
...
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