aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-04-24 07:07:59 +0200
committerMichael Haggerty <mhagger@alum.mit.edu>2016-05-05 16:37:30 +0200
commit728af2832c3e58222965521682414adb9a80932b (patch)
treed6575d24b7de52d932fc29a0e33b267137e72d29
parente95792e532bde75fd4a1e91aecfcf9a28ba23955 (diff)
downloadgit-728af2832c3e58222965521682414adb9a80932b.tar.gz
git-728af2832c3e58222965521682414adb9a80932b.tar.xz
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>
-rw-r--r--dir.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/dir.h b/dir.h
index 301b737a3..5f19acc27 100644
--- a/dir.h
+++ b/dir.h
@@ -262,9 +262,32 @@ extern int is_empty_dir(const char *dir);
extern void setup_standard_excludes(struct dir_struct *dir);
+
+/* Constants for remove_dir_recursively: */
+
+/*
+ * If a non-directory is found within path, stop and return an error.
+ * (In this case some empty directories might already have been
+ * removed.)
+ */
#define REMOVE_DIR_EMPTY_ONLY 01
+
+/*
+ * If any Git work trees are found within path, skip them without
+ * considering it an error.
+ */
#define REMOVE_DIR_KEEP_NESTED_GIT 02
+
+/* Remove the contents of path, but leave path itself. */
#define REMOVE_DIR_KEEP_TOPLEVEL 04
+
+/*
+ * Remove path and its contents, recursively. flags is a combination
+ * of the above REMOVE_DIR_* constants. Return 0 on success.
+ *
+ * This function uses path as temporary scratch space, but restores it
+ * before returning.
+ */
extern int remove_dir_recursively(struct strbuf *path, int flag);
/* tries to remove the path with empty directories along it, ignores ENOENT */