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
18217e7e
Commit
18217e7e
authored
Oct 16, 2012
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Don't be so picky with failed lookups
Not found means not found, and the other way around.
parent
a8918418
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
src/fileops.c
+3
-3
tests-clar/core/env.c
+5
-7
No files found.
src/fileops.c
View file @
18217e7e
...
...
@@ -418,14 +418,14 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
root
.
path
[
0
]
==
L'%'
)
/* i.e. no expansion happened */
{
giterr_set
(
GITERR_OS
,
"Cannot locate the user's profile directory"
);
return
-
1
;
return
GIT_ENOTFOUND
;
}
}
else
{
if
(
win32_expand_path
(
&
root
,
L"%USERPROFILE%
\\
"
)
<
0
||
root
.
path
[
0
]
==
L'%'
)
/* i.e. no expansion happened */
{
giterr_set
(
GITERR_OS
,
"Cannot locate the user's profile directory"
);
return
-
1
;
return
GIT_ENOTFOUND
;
}
}
...
...
@@ -440,7 +440,7 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
if
(
home
==
NULL
)
{
giterr_set
(
GITERR_OS
,
"Global file lookup failed. "
"Cannot locate the user's home directory"
);
return
-
1
;
return
GIT_ENOTFOUND
;
}
if
(
git_buf_joinpath
(
path
,
home
,
filename
)
<
0
)
...
...
tests-clar/core/env.c
View file @
18217e7e
...
...
@@ -87,7 +87,7 @@ void test_core_env__1(void)
{
git_buf
path
=
GIT_BUF_INIT
;
cl_
assert
(
git_futils_find_global_file
(
&
path
,
"nonexistentfile"
)
==
GIT_ENOTFOUND
);
cl_
must_fail
(
git_futils_find_global_file
(
&
path
,
"nonexistentfile"
)
);
#ifdef GIT_WIN32
cl_git_pass
(
cl_setenv
(
"USERPROFILE"
,
"doesnotexist"
));
...
...
@@ -95,7 +95,7 @@ void test_core_env__1(void)
cl_git_pass
(
cl_setenv
(
"HOME"
,
"doesnotexist"
));
#endif
cl_
assert
(
git_futils_find_global_file
(
&
path
,
"nonexistentfile"
)
==
GIT_ENOTFOUND
);
cl_
must_fail
(
git_futils_find_global_file
(
&
path
,
"nonexistentfile"
)
);
#ifdef GIT_WIN32
cl_git_pass
(
cl_setenv
(
"USERPROFILE"
,
NULL
));
...
...
@@ -103,14 +103,12 @@ void test_core_env__1(void)
cl_git_pass
(
cl_setenv
(
"HOME"
,
NULL
));
#endif
cl_assert
(
git_futils_find_global_file
(
&
path
,
"nonexistentfile"
)
==
-
1
);
cl_assert
(
git_futils_find_system_file
(
&
path
,
"nonexistentfile"
)
==
GIT_ENOTFOUND
);
cl_must_fail
(
git_futils_find_global_file
(
&
path
,
"nonexistentfile"
));
cl_must_fail
(
git_futils_find_system_file
(
&
path
,
"nonexistentfile"
));
#ifdef GIT_WIN32
cl_git_pass
(
cl_setenv
(
"PROGRAMFILES"
,
NULL
));
cl_assert
(
git_futils_find_system_file
(
&
path
,
"nonexistentfile"
)
==
-
1
);
cl_must_fail
(
git_futils_find_system_file
(
&
path
,
"nonexistentfile"
));
#endif
git_buf_free
(
&
path
);
...
...
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