Commits

Anonymous committed 3e58763

Fix up read_tree() pathspec matching to use "const char **"

The same way the other pathspecs work. Also fix missing success return
from the matching - not that anything actually uses this yet ;)

Comments (0)

Files changed (2)

 extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned long size, const char *type);
 
 /* Read a tree into the cache */
-extern int read_tree(void *buffer, unsigned long size, int stage, char **paths);
+extern int read_tree(void *buffer, unsigned long size, int stage, const char **paths);
 
 extern int write_sha1_from_fd(const unsigned char *sha1, int fd);
 extern int write_sha1_to_fd(int fd, const unsigned char *sha1);
 	return add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_SKIP_DFCHECK);
 }
 
-static int match_tree_entry(const char *base, int baselen, const char *path, unsigned int mode, char **paths)
+static int match_tree_entry(const char *base, int baselen, const char *path, unsigned int mode, const char **paths)
 {
-	char *match;
+	const char *match;
 	int pathlen;
 
 	if (!paths)
 
 		if (strncmp(path, match, pathlen))
 			continue;
+
+		return 1;
 	}
 	return 0;
 }
 
 static int read_tree_recursive(void *buffer, unsigned long size,
 			       const char *base, int baselen,
-			       int stage, char **match)
+			       int stage, const char **match)
 {
 	while (size) {
 		int len = strlen(buffer)+1;
 	return 0;
 }
 
-int read_tree(void *buffer, unsigned long size, int stage, char **match)
+int read_tree(void *buffer, unsigned long size, int stage, const char **match)
 {
 	return read_tree_recursive(buffer, size, "", 0, stage, match);
 }