summaryrefslogtreecommitdiff
path: root/ls-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-12 17:16:04 -0700
committerPetr Baudis <xpasky@machine.sinus.cz>2005-05-13 07:30:23 +0200
commita15c1c60db9abb981754b1ba3b899f49949ae8b7 (patch)
treedad95b1eb0f312cbce8b511c715d2ca23a0e1776 /ls-files.c
parent1126b419d6835f6b8c45ccfffc0ada9b09e32d87 (diff)
downloadgit-a15c1c60db9abb981754b1ba3b899f49949ae8b7.tar.gz
[PATCH 2/3] Support symlinks in git-ls-files --others.
It is kind of surprising that this was missed in the last round, but the work tree scanner in git-ls-files was still deliberately ignoring symlinks. This patch fixes it, so that --others will correctly report unregistered symlinks. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Petr Baudis <pasky@ucw.cz>
Diffstat (limited to 'ls-files.c')
-rw-r--r--ls-files.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ls-files.c b/ls-files.c
index a2d8cbb2f8..393340628e 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -109,8 +109,9 @@ static void add_name(const char *pathname, int len)
/*
* Read a directory tree. We currently ignore anything but
- * directories and regular files. That's because git doesn't
- * handle them at all yet. Maybe that will change some day.
+ * directories, regular files and symlinks. That's because git
+ * doesn't handle them at all yet. Maybe that will change some
+ * day.
*
* Also, we currently ignore all names starting with a dot.
* That likely will not change.
@@ -141,7 +142,7 @@ static void read_directory(const char *path, const char *base, int baselen)
case DT_UNKNOWN:
if (lstat(fullname, &st))
continue;
- if (S_ISREG(st.st_mode))
+ if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))
break;
if (!S_ISDIR(st.st_mode))
continue;
@@ -152,6 +153,7 @@ static void read_directory(const char *path, const char *base, int baselen)
baselen + len + 1);
continue;
case DT_REG:
+ case DT_LNK:
break;
}
add_name(fullname, baselen + len);