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
830388a7
Commit
830388a7
authored
Jun 21, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clone: non-empty-dir test, now for Win32.
parent
acdd3d95
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
src/clone.c
+23
-2
No files found.
src/clone.c
View file @
830388a7
...
...
@@ -6,7 +6,10 @@
*/
#include <assert.h>
#ifndef GIT_WIN32
#include <dirent.h>
#endif
#include "git2/clone.h"
#include "git2/remote.h"
...
...
@@ -184,8 +187,15 @@ static bool is_dot_or_dotdot(const char *name)
/* TODO: p_opendir, p_closedir */
static
bool
path_is_okay
(
const
char
*
path
)
{
DIR
*
dir
;
#ifdef GIT_WIN32
HANDLE
hFind
=
INVALID_HANDLE_VALUE
;
wchar_t
*
wbuf
;
WIN32_FIND_DATAW
ffd
;
#else
DIR
*
dir
=
NULL
;
struct
dirent
*
e
;
#endif
bool
retval
=
true
;
/* The path must either not exist, or be an empty directory */
...
...
@@ -197,6 +207,16 @@ static bool path_is_okay(const char *path)
return
false
;
}
#ifdef GIT_WIN32
wbuf
=
gitwin_to_utf16
(
path
);
gitwin_append_utf16
(
wbuf
,
"
\\
*"
,
2
);
hFind
=
FindFirstFileW
(
wbuf
,
&
ffd
);
if
(
INVALID_HANDLE_VALUE
!=
hFind
)
{
retval
=
false
;
FindClose
(
hFind
);
}
git__free
(
wbuf
);
#else
dir
=
opendir
(
path
);
if
(
!
dir
)
{
giterr_set
(
GITERR_OS
,
"Couldn't open '%s'"
,
path
);
...
...
@@ -211,8 +231,9 @@ static bool path_is_okay(const char *path)
break
;
}
}
closedir
(
dir
);
#endif
return
retval
;
}
...
...
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