summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2010-03-26 15:25:34 +0000
committerJunio C Hamano <gitster@pobox.com>2010-03-28 09:53:04 -0700
commit80d706afed6c6c6fb3ac9c168a6a958244405b45 (patch)
tree18687c3c32ff6cd9a56ec42d1e46413d1ac8ed35 /git-compat-util.h
parentd1723296af67e6bbadf6e73cd1e921aefafe491f (diff)
downloadgit-80d706afed6c6c6fb3ac9c168a6a958244405b45.tar.gz
Introduce remove_or_warn function
This patch introduces the remove_or_warn function which is a generalised version of the {unlink,rmdir}_or_warn functions. It takes an additional parameter indicating the mode of the file to be removed. The patch also modifies certain functions to use remove_or_warn where appropriate, and adds a test case for a bug fixed by the use of remove_or_warn. Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 67ea4c89f5..3ebf96690a 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -473,5 +473,10 @@ int unlink_or_warn(const char *path);
* Likewise for rmdir(2).
*/
int rmdir_or_warn(const char *path);
+/*
+ * Calls the correct function out of {unlink,rmdir}_or_warn based on
+ * the supplied file mode.
+ */
+int remove_or_warn(unsigned int mode, const char *path);
#endif