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
b3923cf7
Unverified
Commit
b3923cf7
authored
Apr 17, 2019
by
Edward Thomson
Committed by
GitHub
Apr 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5050 from libgit2/ethomson/windows_init_traversal
git_repository_init: stop traversing at windows root
parents
9c402600
45f24e78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
src/fileops.c
+6
-3
tests/repo/init.c
+12
-0
No files found.
src/fileops.c
View file @
b3923cf7
...
...
@@ -489,10 +489,13 @@ int git_futils_mkdir(
assert
(
len
);
/* we've walked all the given path's parents and it's either relative
* or rooted. either way, give up and make the entire path.
/*
* We've walked all the given path's parents and it's either relative
* (the parent is simply '.') or rooted (the length is less than or
* equal to length of the root path). The path may be less than the
* root path length on Windows, where `C:` == `C:/`.
*/
if
((
len
==
1
&&
parent_path
.
ptr
[
0
]
==
'.'
)
||
len
==
root_len
+
1
)
{
if
((
len
==
1
&&
parent_path
.
ptr
[
0
]
==
'.'
)
||
len
<=
root_len
)
{
relative
=
make_path
.
ptr
;
break
;
}
...
...
tests/repo/init.c
View file @
b3923cf7
...
...
@@ -877,3 +877,15 @@ void test_repo_init__at_filesystem_root(void)
git_buf_dispose
(
&
root
);
git_repository_free
(
repo
);
}
void
test_repo_init__nonexistent_paths
(
void
)
{
git_repository
*
repo
;
#ifdef GIT_WIN32
cl_git_fail
(
git_repository_init
(
&
repo
,
"Q:/non/existent/path"
,
0
));
cl_git_fail
(
git_repository_init
(
&
repo
,
"Q:
\\
non
\\
existent
\\
path"
,
0
));
#else
cl_git_fail
(
git_repository_init
(
&
repo
,
"/non/existent/path"
,
0
));
#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