From 90b4a71c493bf24f11b5edee8a519110624a6bea Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 9 Sep 2008 01:27:07 -0700 Subject: is_directory(): a generic helper function A simple "grep -e stat --and -e S_ISDIR" revealed there are many open-coded implementations of this function. Signed-off-by: Junio C Hamano --- rerere.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'rerere.c') diff --git a/rerere.c b/rerere.c index 323e493daf..c38886b22a 100644 --- a/rerere.c +++ b/rerere.c @@ -319,7 +319,6 @@ static int git_rerere_config(const char *var, const char *value, void *cb) static int is_rerere_enabled(void) { - struct stat st; const char *rr_cache; int rr_cache_exists; @@ -327,7 +326,7 @@ static int is_rerere_enabled(void) return 0; rr_cache = git_path("rr-cache"); - rr_cache_exists = !stat(rr_cache, &st) && S_ISDIR(st.st_mode); + rr_cache_exists = is_directory(rr_cache); if (rerere_enabled < 0) return rr_cache_exists; -- cgit v1.2.3