{"thread":{"id":"36228","subject":"[PATCH 1/3] diff-no-index.c read_directory() use is_dot_or_dotdot().","startedAt":"2014-03-19T15:16:20Z","lastAt":"2014-03-19T15:21:18Z","messageCount":2,"participants":["Andrei Dinu","Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"237075","messageId":"1395242180-4559-1-git-send-email-mandrei.dinu@gmail.com","threadId":"36228","inReplyTo":null,"subject":"[PATCH 1/3] diff-no-index.c read_directory() use is_dot_or_dotdot().","fromName":"Andrei Dinu","fromEmail":"mandrei.dinu@gmail.com","sentAt":"2014-03-19T15:16:20Z","receivedAt":"2014-03-19T15:16:20Z","isPatch":true,"sender":{"key":"mandrei.dinu@gmail.com","avatar":null},"body":"Implement read_directory() to use is_dot_or_dotdot() function from dir.h\ninstead of strcmp().\n\nRename read_directory() in read_directory_path() to avoid conflicting with\nread_directory() from dir.h.\n\nSigned-off-by: Andrei Dinu <mandrei.dinu@gmail.com>\n\n\n---\n I plan on applying to GSoc 2014.\n\n diff-no-index.c |    9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex 8e10bff..2d1165f 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -15,8 +15,9 @@\n #include \"log-tree.h\"\n #include \"builtin.h\"\n #include \"string-list.h\"\n+#include \"dir.h\"\n \n-static int read_directory(const char *path, struct string_list *list)\n+static int read_directory_path(const char *path, struct string_list *list)\n {\n \tDIR *dir;\n \tstruct dirent *e;\n@@ -25,7 +26,7 @@ static int read_directory(const char *path, struct string_list *list)\n \t\treturn error(\"Could not open directory %s\", path);\n \n \twhile ((e = readdir(dir)))\n-\t\tif (strcmp(\".\", e->d_name) && strcmp(\"..\", e->d_name))\n+\t\tif (!is_dot_or_dotdot(e->d_name))\n \t\t\tstring_list_insert(list, e->d_name);\n \n \tclosedir(dir);\n@@ -107,9 +108,9 @@ static int queue_diff(struct diff_options *o,\n \t\tint i1, i2, ret = 0;\n \t\tsize_t len1 = 0, len2 = 0;\n \n-\t\tif (name1 && read_directory(name1, &p1))\n+\t\tif (name1 && read_directory_path(name1, &p1))\n \t\t\treturn -1;\n-\t\tif (name2 && read_directory(name2, &p2)) {\n+\t\tif (name2 && read_directory_path(name2, &p2)) {\n \t\t\tstring_list_clear(&p1, 0);\n \t\t\treturn -1;\n \t\t}\n-- \n1.7.9.5\n"},{"id":"237077","messageId":"vpqfvmefc41.fsf@anie.imag.fr","threadId":"36228","inReplyTo":"1395242180-4559-1-git-send-email-mandrei.dinu@gmail.com","subject":"Re: [PATCH 1/3] diff-no-index.c read_directory() use is_dot_or_dotdot().","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-03-19T15:21:18Z","receivedAt":"2014-03-19T15:21:18Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"> Subject: Re: [PATCH 1/3]\n                      ^^^\nI guess you meant PATCH v3. 1/3 means that this is the first patch out\nof 3.\n\nAndrei Dinu <mandrei.dinu@gmail.com> writes:\n\n> Implement read_directory() to use is_dot_or_dotdot() function from dir.h\n> instead of strcmp().\n>\n> Rename read_directory() in read_directory_path() to avoid conflicting with\n> read_directory() from dir.h.\n\nIdeally, these should be two distinct patches. One to rename\nread_directory (no real change), and the next one to use\nis_dot_or_dotdot.\n\nYou may want to take this as an exercice to learn how to split a patch,\nbut I won't insist on that.\n\nOther than that, the patch looks good.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}