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
4cfe2ab6
Commit
4cfe2ab6
authored
Mar 16, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #600 from nulltoken/fix/windows-network-paths
Fix windows network paths
parents
e24fbba9
7b93079b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
src/path.c
+9
-0
tests-clar/core/path.c
+15
-0
No files found.
src/path.c
View file @
4cfe2ab6
...
...
@@ -171,6 +171,15 @@ int git_path_root(const char *path)
/* Does the root of the path look like a windows drive ? */
if
(
isalpha
(
path
[
0
])
&&
(
path
[
1
]
==
':'
))
offset
+=
2
;
/* Are we dealing with a network path? */
else
if
(
path
[
0
]
==
'/'
&&
path
[
1
]
==
'/'
)
{
offset
+=
2
;
/* Skip the computer name segment */
while
(
*
(
path
+
offset
)
&&
*
(
path
+
offset
)
!=
'/'
)
offset
++
;
}
#endif
if
(
*
(
path
+
offset
)
==
'/'
)
...
...
tests-clar/core/path.c
View file @
4cfe2ab6
...
...
@@ -388,3 +388,18 @@ void test_core_path__11_walkup(void)
git_buf_free
(
&
p
);
}
void
test_core_path__12_offset_to_path_root
(
void
)
{
cl_assert
(
git_path_root
(
"non/rooted/path"
)
==
-
1
);
cl_assert
(
git_path_root
(
"/rooted/path"
)
==
0
);
#ifdef GIT_WIN32
/* Windows specific tests */
cl_assert
(
git_path_root
(
"C:non/rooted/path"
)
==
-
1
);
cl_assert
(
git_path_root
(
"C:/rooted/path"
)
==
2
);
cl_assert
(
git_path_root
(
"//computername/sharefolder/resource"
)
==
14
);
cl_assert
(
git_path_root
(
"//computername/sharefolder"
)
==
14
);
cl_assert
(
git_path_root
(
"//computername"
)
==
-
1
);
#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