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
dc07184f
Commit
dc07184f
authored
May 23, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fileops: Make git_futils_mkdir_r() able to cope with Windows network paths
Partially fix libgit2/libgit2sharp#153
parent
7a361e93
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/fileops.c
+15
-7
src/fileops.h
+3
-0
No files found.
src/fileops.c
View file @
dc07184f
...
...
@@ -241,28 +241,36 @@ void git_futils_mmap_free(git_map *out)
int
git_futils_mkdir_r
(
const
char
*
path
,
const
char
*
base
,
const
mode_t
mode
)
{
int
root_path_offset
;
git_buf
make_path
=
GIT_BUF_INIT
;
size_t
start
;
size_t
start
=
0
;
char
*
pp
,
*
sp
;
bool
failed
=
false
;
if
(
base
!=
NULL
)
{
/*
* when a base is being provided, it is supposed to already exist.
* Therefore, no attempt is being made to recursively create this leading path
* segment. It's just skipped. */
start
=
strlen
(
base
);
if
(
git_buf_joinpath
(
&
make_path
,
base
,
path
)
<
0
)
return
-
1
;
}
else
{
start
=
0
;
int
root_path_offset
;
if
(
git_buf_puts
(
&
make_path
,
path
)
<
0
)
return
-
1
;
root_path_offset
=
git_path_root
(
make_path
.
ptr
);
if
(
root_path_offset
>
0
)
{
/*
* On Windows, will skip the drive name (eg. C: or D:)
* or the leading part of a network path (eg. //computer_name ) */
start
=
root_path_offset
;
}
}
pp
=
make_path
.
ptr
+
start
;
root_path_offset
=
git_path_root
(
make_path
.
ptr
);
if
(
root_path_offset
>
0
)
pp
+=
root_path_offset
;
/* On Windows, will skip the drive name (eg. C: or D:) */
while
(
!
failed
&&
(
sp
=
strchr
(
pp
,
'/'
))
!=
NULL
)
{
if
(
sp
!=
pp
&&
git_path_isdir
(
make_path
.
ptr
)
==
false
)
{
*
sp
=
0
;
...
...
src/fileops.h
View file @
dc07184f
...
...
@@ -49,6 +49,9 @@ extern int git_futils_creat_locked_withpath(const char *path, const mode_t dirmo
/**
* Create a path recursively
*
* If a base parameter is being passed, it's expected to be valued with a path pointing to an already
* exisiting directory.
*/
extern
int
git_futils_mkdir_r
(
const
char
*
path
,
const
char
*
base
,
const
mode_t
mode
);
...
...
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