Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 37943cc

Browse files
committed
Merge branch 'bb/diff-no-index-dotdot'
* bb/diff-no-index-dotdot: diff-no-index: replace manual "."/".." check with is_dot_or_dotdot() diff-no-index: rename read_directory()
2 parents cf30bfb + fd3aeea commit 37943cc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

diff-no-index.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#include "log-tree.h"
1616
#include "builtin.h"
1717
#include "string-list.h"
18+
#include "dir.h"
1819

19-
static int read_directory(const char *path, struct string_list *list)
20+
static int read_directory_contents(const char *path, struct string_list *list)
2021
{
2122
DIR *dir;
2223
struct dirent *e;
@@ -25,7 +26,7 @@ static int read_directory(const char *path, struct string_list *list)
2526
return error("Could not open directory %s", path);
2627

2728
while ((e = readdir(dir)))
28-
if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
29+
if (!is_dot_or_dotdot(e->d_name))
2930
string_list_insert(list, e->d_name);
3031

3132
closedir(dir);
@@ -107,9 +108,9 @@ static int queue_diff(struct diff_options *o,
107108
int i1, i2, ret = 0;
108109
size_t len1 = 0, len2 = 0;
109110

110-
if (name1 && read_directory(name1, &p1))
111+
if (name1 && read_directory_contents(name1, &p1))
111112
return -1;
112-
if (name2 && read_directory(name2, &p2)) {
113+
if (name2 && read_directory_contents(name2, &p2)) {
113114
string_list_clear(&p1, 0);
114115
return -1;
115116
}

0 commit comments

Comments
 (0)