{"thread":{"id":"36225","subject":"[PATCH v2] diff-no-index.c : rewrite read_directory() to use is_dot_or_dotdot().","startedAt":"2014-03-19T13:29:13Z","lastAt":"2014-03-19T13:44:54Z","messageCount":2,"participants":["Andrei Dinu","Matthieu Moy"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"237070","messageId":"1395235753-3285-1-git-send-email-mandrei.dinu@gmail.com","threadId":"36225","inReplyTo":null,"subject":"[PATCH v2] diff-no-index.c : rewrite read_directory() to use is_dot_or_dotdot().","fromName":"Andrei Dinu","fromEmail":"mandrei.dinu@gmail.com","sentAt":"2014-03-19T13:29:13Z","receivedAt":"2014-03-19T13:29:13Z","isPatch":true,"sender":{"key":"mandrei.dinu@gmail.com","avatar":null},"body":"replace manual \".\"/\"..\" check with is_dot_or_dotdot().\n\nchoose to implement my own function because did't find the defined one.\n\n[1]: http://article.gmane.org/gmane.comp.version-control.git/244420\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 |    8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex 83cdbf7..d91ea3b 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -19,10 +19,10 @@\n static int is_dot_or_dotdot(const char *path)\n {\n     if (path[0] == '.' && path[1] == '\\0')\n-        return 0;\n+        return 1;\n     else if (path[0] == '.' && path[1] == '.' && path[2] == '\\0')\n-        return 0;\n-    return 1;\n+        return 1;\n+    return 0;\n }\n \n static int read_directory(const char *path, struct string_list *list)\n@@ -34,7 +34,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 (is_dot_or_dotdot(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.7.9.5\n"},{"id":"237071","messageId":"vpqpplii9pl.fsf@anie.imag.fr","threadId":"36225","inReplyTo":"1395235753-3285-1-git-send-email-mandrei.dinu@gmail.com","subject":"Re: [PATCH v2] diff-no-index.c : rewrite read_directory() to use is_dot_or_dotdot().","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-03-19T13:44:54Z","receivedAt":"2014-03-19T13:44:54Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Andrei Dinu <mandrei.dinu@gmail.com> writes:\n\n> replace manual \".\"/\"..\" check with is_dot_or_dotdot().\n\nThis is not what the patch below does.\n\n> choose to implement my own function because did't find the defined one.\n\nThat does not seem to be a good reason to me. Run\n\n  git grep is_dot_or_dotdot\n\nin Git's source code to find it (or use your favorite code navigation\ntool like ctags/etags/...).\n\n> [1]: http://article.gmane.org/gmane.comp.version-control.git/244420\n\n>  diff-no-index.c |    8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/diff-no-index.c b/diff-no-index.c\n> index 83cdbf7..d91ea3b 100644\n> --- a/diff-no-index.c\n> +++ b/diff-no-index.c\n> @@ -19,10 +19,10 @@\n>  static int is_dot_or_dotdot(const char *path)\n>  {\n>      if (path[0] == '.' && path[1] == '\\0')\n> -        return 0;\n> +        return 1;\n>      else if (path[0] == '.' && path[1] == '.' && path[2] == '\\0')\n> -        return 0;\n> -    return 1;\n> +        return 1;\n> +    return 0;\n>  }\n>  \n>  static int read_directory(const char *path, struct string_list *list)\n> @@ -34,7 +34,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 (is_dot_or_dotdot(e->d_name))\n> +\t\tif (!is_dot_or_dotdot(e->d_name))\n>  \t\t\tstring_list_insert(list, e->d_name);\n\nThis could come on top of your previous patch, but when you resend,\nplease sent a new patch, not a \"fixup patch\" like this. Git's history\nshould be clean, and the patch that will eventually be applied should\nnot reflect the trial and error iterations that led to the result.\n\nRead about \"git rebase -i\" and \"git commit --amend\" for more information\nabout this.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}