diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()
Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Brian Bourn <ba.bourn@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Bourn committed
Mar 19, 2014 at 11:58 UTC
fd3aeeab0d41474af86e41d207196abbb7bf78f6
1 file changed
+2
-1
diff-no-index.c
+2
-1
@@ -15,6 +15,7 @@
15
#include "log-tree.h"
16
#include "builtin.h"
17
#include "string-list.h"
18
+#include "dir.h"
19
20
static int read_directory_contents(const char *path, struct string_list *list)
21
{
@@ -25,7 +26,7 @@ static int read_directory_contents(const char *path, struct string_list *list)
26
return error("Could not open directory %s", path);
27
28
while ((e = readdir(dir)))
28
- if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
29
+ if (!is_dot_or_dotdot(e->d_name))
30
string_list_insert(list, e->d_name);
31
32
closedir(dir);