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
81167385
Commit
81167385
authored
Jul 11, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compile and workings on msvc.
Signed-off-by: Ben Straub <bstraub@github.com>
parent
d024419f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
src/checkout.c
+2
-2
src/path.c
+23
-5
tests-clar/clone/clone.c
+2
-2
No files found.
src/checkout.c
View file @
81167385
...
@@ -36,16 +36,16 @@ static int apply_filters(git_buf *out,
...
@@ -36,16 +36,16 @@ static int apply_filters(git_buf *out,
size_t
len
)
size_t
len
)
{
{
int
retcode
=
GIT_ERROR
;
int
retcode
=
GIT_ERROR
;
git_buf
origblob
=
GIT_BUF_INIT
;
git_buf_clear
(
out
);
git_buf_clear
(
out
);
if
(
!
filters
->
length
)
{
if
(
!
filters
->
length
)
{
/* No filters to apply; just copy the result */
/* No filters to apply; just copy the result */
git_buf_put
(
out
,
data
,
len
);
git_buf_put
(
out
,
(
const
char
*
)
data
,
len
);
return
0
;
return
0
;
}
}
git_buf
origblob
=
GIT_BUF_INIT
;
git_buf_attach
(
&
origblob
,
(
char
*
)
data
,
len
);
git_buf_attach
(
&
origblob
,
(
char
*
)
data
,
len
);
retcode
=
git_filters_apply
(
out
,
&
origblob
,
filters
);
retcode
=
git_filters_apply
(
out
,
&
origblob
,
filters
);
git_buf_detach
(
&
origblob
);
git_buf_detach
(
&
origblob
);
...
...
src/path.c
View file @
81167385
...
@@ -391,8 +391,16 @@ bool git_path_isfile(const char *path)
...
@@ -391,8 +391,16 @@ bool git_path_isfile(const char *path)
#ifdef GIT_WIN32
#ifdef GIT_WIN32
static
bool
is_dot_or_dotdotW
(
const
wchar_t
*
name
)
{
return
(
name
[
0
]
==
L'.'
&&
(
name
[
1
]
==
L'\0'
||
(
name
[
1
]
==
L'.'
&&
name
[
2
]
==
L'\0'
)));
}
bool
git_path_is_empty_dir
(
const
char
*
path
)
bool
git_path_is_empty_dir
(
const
char
*
path
)
{
{
git_buf
pathbuf
=
GIT_BUF_INIT
;
HANDLE
hFind
=
INVALID_HANDLE_VALUE
;
HANDLE
hFind
=
INVALID_HANDLE_VALUE
;
wchar_t
*
wbuf
;
wchar_t
*
wbuf
;
WIN32_FIND_DATAW
ffd
;
WIN32_FIND_DATAW
ffd
;
...
@@ -400,13 +408,23 @@ bool git_path_is_empty_dir(const char *path)
...
@@ -400,13 +408,23 @@ bool git_path_is_empty_dir(const char *path)
if
(
!
git_path_isdir
(
path
))
return
false
;
if
(
!
git_path_isdir
(
path
))
return
false
;
wbuf
=
gitwin_to_utf16
(
path
);
git_buf_printf
(
&
pathbuf
,
"%s
\\
*"
,
path
);
gitwin_append_utf16
(
wbuf
,
"
\\
*"
,
2
);
wbuf
=
gitwin_to_utf16
(
git_buf_cstr
(
&
pathbuf
));
hFind
=
FindFirstFileW
(
wbuf
,
&
ffd
);
hFind
=
FindFirstFileW
(
wbuf
,
&
ffd
);
if
(
INVALID_HANDLE_VALUE
!
=
hFind
)
{
if
(
INVALID_HANDLE_VALUE
=
=
hFind
)
{
retval
=
false
;
giterr_set
(
GITERR_OS
,
"Couldn't open '%s'"
,
path
)
;
FindClose
(
hFind
)
;
return
false
;
}
}
do
{
if
(
!
is_dot_or_dotdotW
(
ffd
.
cFileName
))
{
retval
=
false
;
}
}
while
(
FindNextFileW
(
hFind
,
&
ffd
)
!=
0
);
FindClose
(
hFind
);
git_buf_free
(
&
pathbuf
);
git__free
(
wbuf
);
git__free
(
wbuf
);
return
retval
;
return
retval
;
}
}
...
...
tests-clar/clone/clone.c
View file @
81167385
...
@@ -96,10 +96,10 @@ void test_clone_clone__network_full(void)
...
@@ -96,10 +96,10 @@ void test_clone_clone__network_full(void)
#if DO_LIVE_NETWORK_TESTS
#if DO_LIVE_NETWORK_TESTS
git_remote
*
origin
;
git_remote
*
origin
;
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_REPO_URL
,
"./test"
,
NULL
));
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_REPO_URL
,
"./test
2
"
,
NULL
));
cl_assert
(
!
git_repository_is_bare
(
g_repo
));
cl_assert
(
!
git_repository_is_bare
(
g_repo
));
cl_git_pass
(
git_remote_load
(
&
origin
,
g_repo
,
"origin"
));
cl_git_pass
(
git_remote_load
(
&
origin
,
g_repo
,
"origin"
));
git_futils_rmdir_r
(
"./test"
,
GIT_DIRREMOVAL_FILES_AND_DIRS
);
git_futils_rmdir_r
(
"./test
2
"
,
GIT_DIRREMOVAL_FILES_AND_DIRS
);
#endif
#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