diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-09-09 01:27:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-09-09 09:27:45 -0700 |
commit | 90b4a71c493bf24f11b5edee8a519110624a6bea (patch) | |
tree | bc6b950d4b19ba1aee1292970571ad8744b1267b /builtin-clone.c | |
parent | 10708a994a632c392ab58aa7d11e49b322aa1505 (diff) | |
download | git-90b4a71c493bf24f11b5edee8a519110624a6bea.tar.gz git-90b4a71c493bf24f11b5edee8a519110624a6bea.tar.xz |
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 <gitster@pobox.com>
Diffstat (limited to 'builtin-clone.c')
-rw-r--r-- | builtin-clone.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/builtin-clone.c b/builtin-clone.c index c8435295c..a4b87904f 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -77,7 +77,7 @@ static char *get_repo_path(const char *repo, int *is_bundle) for (i = 0; i < ARRAY_SIZE(suffix); i++) { const char *path; path = mkpath("%s%s", repo, suffix[i]); - if (!stat(path, &st) && S_ISDIR(st.st_mode)) { + if (is_directory(path)) { *is_bundle = 0; return xstrdup(make_nonrelative_path(path)); } @@ -140,13 +140,6 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare) return xstrndup(start, end - start); } -static int is_directory(const char *path) -{ - struct stat buf; - - return !stat(path, &buf) && S_ISDIR(buf.st_mode); -} - static void strip_trailing_slashes(char *dir) { char *end = dir + strlen(dir); |