Skip to contentSkip to conversation

microproject for GSOC

PATCH In review ubuntu733 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

ubuntu733

author
#0 lore raw

PATCH 1/1 microproject for GSOC

Apply for GSOC.The microprojects is rewriter diff-index.c

---
 diff-no-index.c |   11 ++++++-----
 dir.h           |    3 ++-
 2 files changed, 8 insertions(+), 6 deletions(-)
diff-no-index.c +6 -5
index 8e10bff..91ece64 100644
@@ -3,7 +3,7 @@
  * Copyright (c) 2007 by Johannes Schindelin
  * Copyright (c) 2008 by Junio C Hamano
  */
-
+#define REMOVE 1
 #include "cache.h"
 #include "color.h"
 #include "commit.h"
@@ -24,10 +24,11 @@ static int read_directory(const char *path, struct string_list *list)
 	if (!(dir = opendir(path)))
 		return error("Could not open directory %s", path);
 
-	while ((e = readdir(dir)))
-		if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
-			string_list_insert(list, e->d_name);
-
+	while ((e = readdir(dir))) {
+		while(is_dot_or_dotdot(e->d_name))
+                      break;
+		string_list_insert(list, e->d_name);
+              }
 	closedir(dir);
 	return 0;
 }
dir.h +2 -1
index 55e5345..1d68818 100644
@@ -138,8 +138,9 @@ extern int match_pathspec(const struct pathspec *pathspec,
 extern int within_depth(const char *name, int namelen, int depth, int max_depth);
 
 extern int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec);
+#ifndef REMOVE
 extern int read_directory(struct dir_struct *, const char *path, int len, const struct pathspec *pathspec);
-
+#endif
 extern int is_excluded_from_list(const char *pathname, int pathlen, const char *basename,
 				 int *dtype, struct exclude_list *el);
 struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len);
Signature · 1 line
1.7.9.5
#1 lore raw

Hi,

Welcome to the Git community, and welcome to the GSOC program. Below are some comments to give you a taste of what a review looks like on this list. Do take the comments seriously (they should be addressed), but don't take them badly: critic is meant to be constructive.

ubuntu733 <[email protected]> writes:
^^^^^^^^^

Please, use a real name when you contribute to Git.

Quoted 1 line

Apply for GSOC.The microprojects is rewriter diff-index.c

This part of your message will become the commit message (i.e. cast in stone forever in git.git's history). The point is not that you want to apply for GSOC, but what the patch does and more importantly why it does it.

Quoted 1 line

+#define REMOVE 1

If the code is to be removed, then remove it. That's why we use a version control system ;-).

diff-no-index.c static int read_directory(const char *path, struct string_list *list) · line 28

Quoted 6 lines
diff-no-index.c +2 -4
-	while ((e = readdir(dir)))
-		if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
-			string_list_insert(list, e->d_name);
-
+	while ((e = readdir(dir))) {
+		while(is_dot_or_dotdot(e->d_name))

Missing space between "while" and "(".

Quoted 1 line

+ break;

Broken indentation (indent with space).

This while (...) break; seems really weird to me: if the condition is false, then you exit the loop because it's a while loop, and if the condition is true, you exit the loop because of the break. Isn't that a no-op?

diff-no-index.c static int read_directory(const char *path, struct string_list *list) · line 31

Quoted 2 lines
diff-no-index.c +2 -0
+		string_list_insert(list, e->d_name);
+              }

Broken indentation (misplaced }).

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
author
#2 lore raw

Thank you for your comments.I will amend those issues .As a Chinese student,what name should I use?My Chinese name is ok? I am very interest in Open source.What can I do to increase my chance?

Quoted 50 lines · At 2014-03-15 01:10:57,"Matthieu Moy" <[email protected]> wrote:

Hi,

Welcome to the Git community, and welcome to the GSOC program. Below are some comments to give you a taste of what a review looks like on this list. Do take the comments seriously (they should be addressed), but don't take them badly: critic is meant to be constructive.

ubuntu733 <[email protected]> writes:
^^^^^^^^^

Please, use a real name when you contribute to Git.

Quoted 1 line

Apply for GSOC.The microprojects is rewriter diff-index.c

This part of your message will become the commit message (i.e. cast in stone forever in git.git's history). The point is not that you want to apply for GSOC, but what the patch does and more importantly why it does it.

Quoted 1 line

+#define REMOVE 1

If the code is to be removed, then remove it. That's why we use a version control system ;-).

diff-no-index.c static int read_directory(const char *path, struct string_list *list) · line 28

Quoted 6 lines
diff-no-index.c +2 -4
-	while ((e = readdir(dir)))
-		if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
-			string_list_insert(list, e->d_name);
-
+	while ((e = readdir(dir))) {
+		while(is_dot_or_dotdot(e->d_name))

Missing space between "while" and "(".

Quoted 1 line

+ break;

Broken indentation (indent with space).

This while (...) break; seems really weird to me: if the condition is false, then you exit the loop because it's a while loop, and if the condition is true, you exit the loop because of the break. Isn't that a no-op?

diff-no-index.c static int read_directory(const char *path, struct string_list *list) · line 31

Quoted 2 lines
diff-no-index.c +2 -0
+		string_list_insert(list, e->d_name);
+              }

Broken indentation (misplaced }).

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#3 lore raw
Quoted 2 lines · 沈承恩

Thank you for your comments.I will amend those issues .As a Chinese student,what name should I use?My Chinese name is ok?

I guess it is. The git.git history already has contribution from 张忠山 for example (I don't know if it is chineese, but it looks so from my French eyes).

Quoted 1 line

I am very interest in Open source.What can I do to increase my chance?

Interesting blog post to read:
http://softwareswirl.blogspot.fr/2014/03/my-secret-tip-for-gsoc-success.html

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
author
#4 lore raw
In reply to Matthieu Moy

Thank you for your comments.I will amend those issues .As a Chinese student,what name should I use?My Chinese name is ok?

Quoted 50 lines · At 2014-03-15 01:10:57,"Matthieu Moy" <[email protected]> wrote:

Hi,

Welcome to the Git community, and welcome to the GSOC program. Below are some comments to give you a taste of what a review looks like on this list. Do take the comments seriously (they should be addressed), but don't take them badly: critic is meant to be constructive.

ubuntu733 <[email protected]> writes:
^^^^^^^^^

Please, use a real name when you contribute to Git.

Quoted 1 line

Apply for GSOC.The microprojects is rewriter diff-index.c

This part of your message will become the commit message (i.e. cast in stone forever in git.git's history). The point is not that you want to apply for GSOC, but what the patch does and more importantly why it does it.

Quoted 1 line

+#define REMOVE 1

If the code is to be removed, then remove it. That's why we use a version control system ;-).

diff-no-index.c static int read_directory(const char *path, struct string_list *list) · line 28

Quoted 6 lines
diff-no-index.c +2 -4
-	while ((e = readdir(dir)))
-		if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
-			string_list_insert(list, e->d_name);
-
+	while ((e = readdir(dir))) {
+		while(is_dot_or_dotdot(e->d_name))

Missing space between "while" and "(".

Quoted 1 line

+ break;

Broken indentation (indent with space).

This while (...) break; seems really weird to me: if the condition is false, then you exit the loop because it's a while loop, and if the condition is true, you exit the loop because of the break. Isn't that a no-op?

diff-no-index.c static int read_directory(const char *path, struct string_list *list) · line 31

Quoted 2 lines
diff-no-index.c +2 -0
+		string_list_insert(list, e->d_name);
+              }

Broken indentation (misplaced }).

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/