remove_dir_recursively(): add docstring

Add a docstring for the remove_dir_recursively() function and the REMOVE_DIR_* flags that can be passed to it. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

Michael Haggerty committed Apr 24, 2016 at 07:07 UTC 728af2832c3e58222965521682414adb9a80932b
1 file changed +23
dir.h
+23
@@ -262,9 +262,32 @@ extern int is_empty_dir(const char *dir);
262
263 extern void setup_standard_excludes(struct dir_struct *dir);
264
265 +
266 +/* Constants for remove_dir_recursively: */
267 +
268 +/*
269 + * If a non-directory is found within path, stop and return an error.
270 + * (In this case some empty directories might already have been
271 + * removed.)
272 + */
273 #define REMOVE_DIR_EMPTY_ONLY 01
274 +
275 +/*
276 + * If any Git work trees are found within path, skip them without
277 + * considering it an error.
278 + */
279 #define REMOVE_DIR_KEEP_NESTED_GIT 02
280 +
281 +/* Remove the contents of path, but leave path itself. */
282 #define REMOVE_DIR_KEEP_TOPLEVEL 04
283 +
284 +/*
285 + * Remove path and its contents, recursively. flags is a combination
286 + * of the above REMOVE_DIR_* constants. Return 0 on success.
287 + *
288 + * This function uses path as temporary scratch space, but restores it
289 + * before returning.
290 + */
291 extern int remove_dir_recursively(struct strbuf *path, int flag);
292
293 /* tries to remove the path with empty directories along it, ignores ENOENT */