summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-07-14 11:39:27 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-14 11:39:27 -0700
commit3e58763542ab858ed2b2c7c704594f420df28c8b (patch)
treed8ac1c38a08c621eb237c962dfc099fc48c83970 /tree.c
parent0ca14a57f159fc9d0923dbb122705dd8d6a45488 (diff)
downloadgit-3e58763542ab858ed2b2c7c704594f420df28c8b.tar.gz
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 ;)
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tree.c b/tree.c
index 8dc27e3b73..dabc2e7a2c 100644
--- a/tree.c
+++ b/tree.c
@@ -21,9 +21,9 @@ static int read_one_entry(unsigned char *sha1, const char *base, int baselen, co
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)
@@ -59,13 +59,15 @@ static int match_tree_entry(const char *base, int baselen, const char *path, uns
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;
@@ -115,7 +117,7 @@ static int read_tree_recursive(void *buffer, unsigned long size,
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);
}