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
9ce2e7b3
Commit
9ce2e7b3
authored
Sep 17, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`mkdir`: cope with root path on win32
parent
e164ddb1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
src/fileops.c
+4
-3
src/path.h
+1
-1
No files found.
src/fileops.c
View file @
9ce2e7b3
...
...
@@ -408,7 +408,7 @@ int git_futils_mkdir(
struct
git_futils_mkdir_options
opts
=
{
0
};
struct
stat
st
;
size_t
depth
=
0
;
int
len
=
0
,
error
;
int
len
=
0
,
root_len
,
error
;
if
((
error
=
git_buf_puts
(
&
make_path
,
path
))
<
0
||
(
error
=
mkdir_canonicalize
(
&
make_path
,
flags
))
<
0
||
...
...
@@ -416,6 +416,8 @@ int git_futils_mkdir(
make_path
.
size
==
0
)
goto
done
;
root_len
=
git_path_root
(
make_path
.
ptr
);
/* find the first parent directory that exists. this will be used
* as the base to dirname_relative.
*/
...
...
@@ -442,8 +444,7 @@ int git_futils_mkdir(
/* 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.
*/
if
(
len
==
1
&&
(
parent_path
.
ptr
[
0
]
==
'.'
||
parent_path
.
ptr
[
0
]
==
'/'
))
{
if
((
len
==
1
&&
parent_path
.
ptr
[
0
]
==
'.'
)
||
len
==
root_len
+
1
)
{
relative
=
make_path
.
ptr
;
break
;
}
...
...
src/path.h
View file @
9ce2e7b3
...
...
@@ -72,7 +72,7 @@ extern const char *git_path_topdir(const char *path);
* This will return a number >= 0 which is the offset to the start of the
* path, if the path is rooted (i.e. "/rooted/path" returns 0 and
* "c:/windows/rooted/path" returns 2). If the path is not rooted, this
* returns
< 0
.
* returns
-1
.
*/
extern
int
git_path_root
(
const
char
*
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