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
d31e5655
Commit
d31e5655
authored
Sep 03, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1827 from libgit2/relative-path-win32-fix
Fix resolving relative windows network paths
parents
0d1af399
cae52938
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
src/path.c
+2
-2
tests-clar/core/path.c
+15
-1
No files found.
src/path.c
View file @
d31e5655
...
...
@@ -242,8 +242,8 @@ int git_path_root(const char *path)
#ifdef GIT_WIN32
/* Are we dealing with a windows network path? */
else
if
((
path
[
0
]
==
'/'
&&
path
[
1
]
==
'/'
)
||
(
path
[
0
]
==
'\\'
&&
path
[
1
]
==
'\\'
))
else
if
((
path
[
0
]
==
'/'
&&
path
[
1
]
==
'/'
&&
path
[
2
]
!=
'/'
)
||
(
path
[
0
]
==
'\\'
&&
path
[
1
]
==
'\\'
&&
path
[
2
]
!=
'\\'
))
{
offset
+=
2
;
...
...
tests-clar/core/path.c
View file @
d31e5655
...
...
@@ -538,7 +538,6 @@ void test_core_path__15_resolve_relative(void)
assert_resolve_relative
(
&
buf
,
"a/b/"
,
"a/b/."
);
assert_resolve_relative
(
&
buf
,
"/a/b/c"
,
"///a/b/c"
);
assert_resolve_relative
(
&
buf
,
"/a/b/c"
,
"//a/b/c"
);
assert_resolve_relative
(
&
buf
,
"/"
,
"////"
);
assert_resolve_relative
(
&
buf
,
"/a"
,
"///a"
);
assert_resolve_relative
(
&
buf
,
"/"
,
"///."
);
...
...
@@ -565,5 +564,20 @@ void test_core_path__15_resolve_relative(void)
cl_git_pass
(
git_buf_sets
(
&
buf
,
"////.."
));
cl_git_fail
(
git_path_resolve_relative
(
&
buf
,
0
));
/* things that start with Windows network paths */
#ifdef GIT_WIN32
assert_resolve_relative
(
&
buf
,
"//a/b/c"
,
"//a/b/c"
);
assert_resolve_relative
(
&
buf
,
"//a/"
,
"//a/b/.."
);
assert_resolve_relative
(
&
buf
,
"//a/b/c"
,
"//a/Q/../b/x/y/../../c"
);
cl_git_pass
(
git_buf_sets
(
&
buf
,
"//a/b/../.."
));
cl_git_fail
(
git_path_resolve_relative
(
&
buf
,
0
));
#else
assert_resolve_relative
(
&
buf
,
"/a/b/c"
,
"//a/b/c"
);
assert_resolve_relative
(
&
buf
,
"/a/"
,
"//a/b/.."
);
assert_resolve_relative
(
&
buf
,
"/a/b/c"
,
"//a/Q/../b/x/y/../../c"
);
assert_resolve_relative
(
&
buf
,
"/"
,
"//a/b/../.."
);
#endif
git_buf_free
(
&
buf
);
}
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