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
c3dcbe84
Commit
c3dcbe84
authored
Apr 09, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite `git_repository__cleanup_files`
parent
c0311295
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
src/repository.c
+20
-14
No files found.
src/repository.c
View file @
c3dcbe84
...
@@ -1955,26 +1955,32 @@ int git_repository_state(git_repository *repo)
...
@@ -1955,26 +1955,32 @@ int git_repository_state(git_repository *repo)
return
state
;
return
state
;
}
}
int
git_repository__cleanup_files
(
git_repository
*
repo
,
const
char
*
files
[],
size_t
files_len
)
int
git_repository__cleanup_files
(
git_repository
*
repo
,
const
char
*
files
[],
size_t
files_len
)
{
{
git_buf
path
=
GIT_BUF_INIT
;
git_buf
buf
=
GIT_BUF_INIT
;
size_t
i
;
size_t
i
;
int
error
=
0
;
int
error
;
for
(
i
=
0
;
i
<
files_len
;
++
i
)
{
for
(
error
=
0
,
i
=
0
;
!
error
&&
i
<
files_len
;
++
i
)
{
git_buf_clear
(
&
path
)
;
const
char
*
path
;
if
((
error
=
git_buf_joinpath
(
&
path
,
repo
->
path_repository
,
files
[
i
]))
<
0
||
if
(
git_buf_joinpath
(
&
buf
,
repo
->
path_repository
,
files
[
i
])
<
0
)
(
git_path_isfile
(
git_buf_cstr
(
&
path
))
&&
return
-
1
;
(
error
=
p_unlink
(
git_buf_cstr
(
&
path
)))
<
0
)
||
(
git_path_isdir
(
git_buf_cstr
(
&
path
))
&&
(
error
=
git_futils_rmdir_r
(
git_buf_cstr
(
&
path
),
NULL
,
GIT_RMDIR_REMOVE_FILES
|
GIT_RMDIR_REMOVE_BLOCKERS
))
<
0
))
goto
done
;
}
done:
path
=
git_buf_cstr
(
&
buf
);
git_buf_free
(
&
path
);
if
(
git_path_isfile
(
path
))
{
error
=
p_unlink
(
path
);
}
else
if
(
git_path_isdir
(
path
))
{
error
=
git_futils_rmdir_r
(
path
,
NULL
,
GIT_RMDIR_REMOVE_FILES
|
GIT_RMDIR_REMOVE_BLOCKERS
);
}
git_buf_clear
(
&
buf
);
}
git_buf_free
(
&
buf
);
return
error
;
return
error
;
}
}
...
...
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