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
0de26b7c
Commit
0de26b7c
authored
Dec 20, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2767 from linquize/winpath
More Windows Path checking
parents
6afc0bfa
6987a580
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
+16
-1
src/path.c
+1
-1
tests/path/core.c
+15
-0
No files found.
src/path.c
View file @
0de26b7c
...
...
@@ -1254,7 +1254,7 @@ GIT_INLINE(bool) verify_dospath(
if
(
len
<
last
||
git__strncasecmp
(
component
,
dospath
,
3
)
!=
0
)
return
true
;
if
(
trailing_num
&&
!
git__isdigit
(
component
[
3
]
))
if
(
trailing_num
&&
(
component
[
3
]
<
'1'
||
component
[
3
]
>
'9'
))
return
true
;
return
(
len
>
last
&&
...
...
tests/path/core.c
View file @
0de26b7c
...
...
@@ -203,6 +203,9 @@ void test_path_core__isvalid_dos_paths(void)
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"aux.asdf"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"aux.asdf
\\
zippy"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"aux:asdf
\\
foobar"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"con"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"prn"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"nul"
,
0
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"aux"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"aux."
,
GIT_PATH_REJECT_DOS_PATHS
));
...
...
@@ -210,6 +213,9 @@ void test_path_core__isvalid_dos_paths(void)
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"aux.asdf"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"aux.asdf
\\
zippy"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"aux:asdf
\\
foobar"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"con"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"prn"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"nul"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"aux1"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"aux1"
,
GIT_PATH_REJECT_DOS_PATHS
));
...
...
@@ -225,6 +231,8 @@ void test_path_core__isvalid_dos_paths_withnum(void)
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com1.asdf"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com1.asdf
\\
zippy"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com1:asdf
\\
foobar"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com1
\\
foo"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"lpt1"
,
0
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"com1"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"com1."
,
GIT_PATH_REJECT_DOS_PATHS
));
...
...
@@ -232,11 +240,18 @@ void test_path_core__isvalid_dos_paths_withnum(void)
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"com1.asdf"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"com1.asdf
\\
zippy"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"com1:asdf
\\
foobar"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"com1/foo"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
false
,
git_path_isvalid
(
NULL
,
"lpt1"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com0"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com0"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com10"
,
0
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com10"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"comn"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"com1
\\
foo"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"lpt0"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"lpt10"
,
GIT_PATH_REJECT_DOS_PATHS
));
cl_assert_equal_b
(
true
,
git_path_isvalid
(
NULL
,
"lptn"
,
GIT_PATH_REJECT_DOS_PATHS
));
}
void
test_path_core__isvalid_nt_chars
(
void
)
...
...
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