{"thread":{"id":"595","subject":"[PATCH 2/3] Support symlinks in git-ls-files --others.","startedAt":"2005-05-13T00:16:04Z","lastAt":"2005-05-13T00:16:04Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"3216","messageId":"7vwtq4asl7.fsf@assigned-by-dhcp.cox.net","threadId":"595","inReplyTo":null,"subject":"[PATCH 2/3] Support symlinks in git-ls-files --others.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-13T00:16:04Z","receivedAt":"2005-05-13T00:16:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It is kind of surprising that this was missed in the last round,\nbut the work tree scanner in git-ls-files was still deliberately\nignoring symlinks.  This patch fixes it, so that --others will\ncorrectly report unregistered symlinks.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\ncache.h    |    1 +\nls-files.c |    8 +++++---\n2 files changed, 6 insertions(+), 3 deletions(-)\n\n--- a/cache.h\n+++ b/cache.h\n@@ -27,6 +27,7 @@\n #define DT_UNKNOWN\t0\n #define DT_DIR\t\t1\n #define DT_REG\t\t2\n+#define DT_LNK\t\t3\n #define DTYPE(de)\tDT_UNKNOWN\n #endif\n \n--- a/ls-files.c\n+++ b/ls-files.c\n@@ -109,8 +109,9 @@\n \n /*\n  * Read a directory tree. We currently ignore anything but\n- * directories and regular files. That's because git doesn't\n- * handle them at all yet. Maybe that will change some day.\n+ * directories, regular files and symlinks. That's because git\n+ * doesn't handle them at all yet. Maybe that will change some\n+ * day.\n  *\n  * Also, we currently ignore all names starting with a dot.\n  * That likely will not change.\n@@ -141,7 +142,7 @@\n \t\t\tcase DT_UNKNOWN:\n \t\t\t\tif (lstat(fullname, &st))\n \t\t\t\t\tcontinue;\n-\t\t\t\tif (S_ISREG(st.st_mode))\n+\t\t\t\tif (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))\n \t\t\t\t\tbreak;\n \t\t\t\tif (!S_ISDIR(st.st_mode))\n \t\t\t\t\tcontinue;\n@@ -152,6 +153,7 @@\n \t\t\t\t\t       baselen + len + 1);\n \t\t\t\tcontinue;\n \t\t\tcase DT_REG:\n+\t\t\tcase DT_LNK:\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\tadd_name(fullname, baselen + len);\n------------------------------------------------\n\n"}]}