aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-09 01:27:07 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-09 09:27:45 -0700
commit90b4a71c493bf24f11b5edee8a519110624a6bea (patch)
treebc6b950d4b19ba1aee1292970571ad8744b1267b /sha1_file.c
parent10708a994a632c392ab58aa7d11e49b322aa1505 (diff)
downloadgit-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 'sha1_file.c')
-rw-r--r--sha1_file.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 9ee1ed16a..ae550e89c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -250,7 +250,6 @@ static void read_info_alternates(const char * alternates, int depth);
*/
static int link_alt_odb_entry(const char * entry, int len, const char * relative_base, int depth)
{
- struct stat st;
const char *objdir = get_object_directory();
struct alternate_object_database *ent;
struct alternate_object_database *alt;
@@ -281,7 +280,7 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative
ent->base[pfxlen] = ent->base[entlen-1] = 0;
/* Detect cases where alternate disappeared */
- if (stat(ent->base, &st) || !S_ISDIR(st.st_mode)) {
+ if (!is_directory(ent->base)) {
error("object directory %s does not exist; "
"check .git/objects/info/alternates.",
ent->base);