{"thread":{"id":"36217","subject":"[PATCH v2 1/2] [GSoC] diff: rename read_directory()","startedAt":"2014-03-19T06:29:37Z","lastAt":"2014-03-19T08:21:04Z","messageCount":4,"participants":["Brian Bourn","Eric Sunshine"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"237040","messageId":"1395210578-1532-1-git-send-email-ba.bourn@gmail.com","threadId":"36217","inReplyTo":null,"subject":"[PATCH v2 1/2] [GSoC] diff: rename read_directory()","fromName":"Brian Bourn","fromEmail":"ba.bourn@gmail.com","sentAt":"2014-03-19T06:29:37Z","receivedAt":"2014-03-19T06:29:37Z","isPatch":true,"sender":{"key":"ba.bourn@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3165958?v=4"},"body":"From: Brian Bourn <ba.bourn@gmail.com>\n\nIt is desirable to replace manual checking of \".\" or \"..\"\nin diff-no-index.c with is_dot_or_dotdot(), which is defined\nin dir.h. However, dir.h declares a read_directory which conflicts\nwith a (different) static read_directory() defined in\nin diff-no-index.c. As a preparatory step, rename the local\nread_directory() to avoid the collision\n\nSigned-off-by: Brian Bourn <ba.bourn@gmail.com>\n---\nPart 1 of my GSoC submission\n diff-no-index.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex 8e10bff..ec51106 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -16,7 +16,7 @@\n #include \"builtin.h\"\n #include \"string-list.h\"\n \n-static int read_directory(const char *path, struct string_list *list)\n+static int read_directory_contents(const char *path, struct string_list *list)\n {\n \tDIR *dir;\n \tstruct dirent *e;\n@@ -107,9 +107,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_contents(name1, &p1))\n \t\t\treturn -1;\n-\t\tif (name2 && read_directory(name2, &p2)) {\n+\t\tif (name2 && read_directory_contents(name2, &p2)) {\n \t\t\tstring_list_clear(&p1, 0);\n \t\t\treturn -1;\n \t\t}\n-- \n1.9.0\n"},{"id":"237041","messageId":"1395210578-1532-2-git-send-email-ba.bourn@gmail.com","threadId":"36217","inReplyTo":"1395210578-1532-1-git-send-email-ba.bourn@gmail.com","subject":"[PATCH v2 2/2] [GSoC] diff:use is_dot_or_dotdot() in code","fromName":"Brian Bourn","fromEmail":"ba.bourn@gmail.com","sentAt":"2014-03-19T06:29:38Z","receivedAt":"2014-03-19T06:29:38Z","isPatch":true,"sender":{"key":"ba.bourn@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3165958?v=4"},"body":"From: Brian Bourn <ba.bourn@gmail.com>\n\nSubject: replace manual \".\"/\"..\" check with is_dot_or_dotdot()\n\nSigned-off-by: Brian Bourn <ba.bourn@gmail.com>\n---\nPart 2 of my GSoC submission where the actual change is made\n diff-no-index.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex ec51106..c554691 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -15,6 +15,7 @@\n #include \"log-tree.h\"\n #include \"builtin.h\"\n #include \"string-list.h\"\n+#include \"dir.h\"\n \n static int read_directory_contents(const char *path, struct string_list *list)\n {\n@@ -25,7 +26,7 @@ static int read_directory_contents(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-- \n1.9.0\n"},{"id":"237045","messageId":"CAPig+cQ+9WNoNU54DHE-GnHQ=BCix9Efm+O_jP+a6mFL_yvmxg@mail.gmail.com","threadId":"36217","inReplyTo":"1395210578-1532-1-git-send-email-ba.bourn@gmail.com","subject":"Re: [PATCH v2 1/2] [GSoC] diff: rename read_directory()","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-03-19T08:12:55Z","receivedAt":"2014-03-19T08:12:55Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Mar 19, 2014 at 2:29 AM, Brian Bourn <ba.bourn@gmail.com> wrote:\n> Subject: diff: rename read_directory()\n\nI think you mean \"diff-no-index\" rather than \"diff\".\n\n> From: Brian Bourn <ba.bourn@gmail.com>\n\nUnless this is intentionally different from the address from which you\nsent the email, you shouldn't include it here. \"git am\" will\nautomatically pick up your name and address directly from the email\nheader when applying your patch.\n\n> It is desirable to replace manual checking of \".\" or \"..\"\n> in diff-no-index.c with is_dot_or_dotdot(), which is defined\n> in dir.h. However, dir.h declares a read_directory which conflicts\n> with a (different) static read_directory() defined in\n> in diff-no-index.c. As a preparatory step, rename the local\n> read_directory() to avoid the collision\n\nBetter. Add a period at the end.\n\nOther than these minor points, the patch looks good.\n\n> Signed-off-by: Brian Bourn <ba.bourn@gmail.com>\n> ---\n> Part 1 of my GSoC submission\n>  diff-no-index.c | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/diff-no-index.c b/diff-no-index.c\n> index 8e10bff..ec51106 100644\n> --- a/diff-no-index.c\n> +++ b/diff-no-index.c\n> @@ -16,7 +16,7 @@\n>  #include \"builtin.h\"\n>  #include \"string-list.h\"\n>\n> -static int read_directory(const char *path, struct string_list *list)\n> +static int read_directory_contents(const char *path, struct string_list *list)\n>  {\n>         DIR *dir;\n>         struct dirent *e;\n> @@ -107,9 +107,9 @@ static int queue_diff(struct diff_options *o,\n>                 int i1, i2, ret = 0;\n>                 size_t len1 = 0, len2 = 0;\n>\n> -               if (name1 && read_directory(name1, &p1))\n> +               if (name1 && read_directory_contents(name1, &p1))\n>                         return -1;\n> -               if (name2 && read_directory(name2, &p2)) {\n> +               if (name2 && read_directory_contents(name2, &p2)) {\n>                         string_list_clear(&p1, 0);\n>                         return -1;\n>                 }\n> --\n> 1.9.0\n"},{"id":"237046","messageId":"CAPig+cQF8p0qeNWhGOZ1tqzvEaUGwSd4S0-7FxcuXCvKNE33Kw@mail.gmail.com","threadId":"36217","inReplyTo":"1395210578-1532-2-git-send-email-ba.bourn@gmail.com","subject":"Re: [PATCH v2 2/2] [GSoC] diff:use is_dot_or_dotdot() in code","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-03-19T08:21:04Z","receivedAt":"2014-03-19T08:21:04Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Mar 19, 2014 at 2:29 AM, Brian Bourn <ba.bourn@gmail.com> wrote:\n> Subject: diff:use is_dot_or_dotdot() in code\n\nWrong subject. See below.\n\n> From: Brian Bourn <ba.bourn@gmail.com>\n\nDrop this. \"git am\" will grab your name and address automatically from\nthe email header when applying the patch.\n\n> Subject: replace manual \".\"/\"..\" check with is_dot_or_dotdot()\n\nThis should be the actual subject of this email; and the old, less\ninformative subject, which is still present, should be dropped. Stated\ndifferently, make this text the first line of your commit message.\n\"git format-patch\" will automatically extract that line as the email's\nSubject:, and \"git am\" will convert the Subject: back to the first\nline of the commit message (without the \"Subject:\" prefix) when\napplying the patch.\n\nOther than that, the patch looks fine.\n\n> Signed-off-by: Brian Bourn <ba.bourn@gmail.com>\n> ---\n> Part 2 of my GSoC submission where the actual change is made\n>  diff-no-index.c | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n>\n> diff --git a/diff-no-index.c b/diff-no-index.c\n> index ec51106..c554691 100644\n> --- a/diff-no-index.c\n> +++ b/diff-no-index.c\n> @@ -15,6 +15,7 @@\n>  #include \"log-tree.h\"\n>  #include \"builtin.h\"\n>  #include \"string-list.h\"\n> +#include \"dir.h\"\n>\n>  static int read_directory_contents(const char *path, struct string_list *list)\n>  {\n> @@ -25,7 +26,7 @@ static int read_directory_contents(const char *path, struct string_list *list)\n>                 return error(\"Could not open directory %s\", path);\n>\n>         while ((e = readdir(dir)))\n> -               if (strcmp(\".\", e->d_name) && strcmp(\"..\", e->d_name))\n> +               if (!is_dot_or_dotdot(e->d_name))\n>                         string_list_insert(list, e->d_name);\n>\n>         closedir(dir);\n> --\n> 1.9.0\n"}]}