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
3b3a1017
Commit
3b3a1017
authored
Feb 25, 2011
by
nulltoken
Committed by
Vicent Marti
Mar 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added rmdir_recurs(), a test helper function which recursively removes the content of a directory.
parent
47d0db78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
tests/test_helpers.c
+26
-0
tests/test_helpers.h
+1
-0
No files found.
tests/test_helpers.c
View file @
3b3a1017
...
@@ -175,3 +175,29 @@ int cmp_files(const char *a, const char *b)
...
@@ -175,3 +175,29 @@ int cmp_files(const char *a, const char *b)
return
error
;
return
error
;
}
}
static
int
remove_filesystem_element_recurs
(
void
*
GIT_UNUSED
(
nil
),
char
*
path
)
{
char
temp_path
[
GIT_PATH_MAX
];
int
error
=
GIT_SUCCESS
;
GIT_UNUSED_ARG
(
nil
);
error
=
gitfo_isdir
(
path
);
if
(
error
==
GIT_SUCCESS
)
{
strcpy
(
temp_path
,
path
);
error
=
gitfo_dirent
(
temp_path
,
sizeof
(
temp_path
),
remove_filesystem_element_recurs
,
NULL
);
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
rmdir
(
path
);
}
return
gitfo_unlink
(
path
);
}
int
rmdir_recurs
(
char
*
directory_path
)
{
return
remove_filesystem_element_recurs
(
NULL
,
directory_path
);
}
tests/test_helpers.h
View file @
3b3a1017
...
@@ -58,6 +58,7 @@ extern int remove_loose_object(const char *odb_dir, git_object *object);
...
@@ -58,6 +58,7 @@ extern int remove_loose_object(const char *odb_dir, git_object *object);
extern
int
cmp_files
(
const
char
*
a
,
const
char
*
b
);
extern
int
cmp_files
(
const
char
*
a
,
const
char
*
b
);
extern
int
copy_file
(
const
char
*
source
,
const
char
*
dest
);
extern
int
copy_file
(
const
char
*
source
,
const
char
*
dest
);
extern
int
rmdir_recurs
(
char
*
directory_path
);
#endif
#endif
/* INCLUDE_test_helpers_h__ */
/* INCLUDE_test_helpers_h__ */
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