aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ui-tree.c b/ui-tree.c
index e4c3d22..4ab0137 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -121,9 +121,8 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
121} 121}
122 122
123 123
124static int ls_item(const unsigned char *sha1, const char *base, int baselen, 124static int ls_item(const unsigned char *sha1, struct strbuf *base,
125 const char *pathname, unsigned int mode, int stage, 125 const char *pathname, unsigned mode, int stage, void *cbdata)
126 void *cbdata)
127{ 126{
128 struct walk_tree_context *walk_tree_ctx = cbdata; 127 struct walk_tree_context *walk_tree_ctx = cbdata;
129 char *name; 128 char *name;
@@ -216,16 +215,15 @@ static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_cont
216} 215}
217 216
218 217
219static int walk_tree(const unsigned char *sha1, const char *base, int baselen, 218static int walk_tree(const unsigned char *sha1, struct strbuf *base,
220 const char *pathname, unsigned mode, int stage, 219 const char *pathname, unsigned mode, int stage, void *cbdata)
221 void *cbdata)
222{ 220{
223 struct walk_tree_context *walk_tree_ctx = cbdata; 221 struct walk_tree_context *walk_tree_ctx = cbdata;
224 static char buffer[PATH_MAX]; 222 static char buffer[PATH_MAX];
225 223
226 if (walk_tree_ctx->state == 0) { 224 if (walk_tree_ctx->state == 0) {
227 memcpy(buffer, base, baselen); 225 memcpy(buffer, base->buf, base->len);
228 strcpy(buffer + baselen, pathname); 226 strcpy(buffer + base->len, pathname);
229 if (strcmp(walk_tree_ctx->match_path, buffer)) 227 if (strcmp(walk_tree_ctx->match_path, buffer))
230 return READ_TREE_RECURSIVE; 228 return READ_TREE_RECURSIVE;
231 229
@@ -238,11 +236,10 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
238 return 0; 236 return 0;
239 } 237 }
240 } 238 }
241 ls_item(sha1, base, baselen, pathname, mode, stage, walk_tree_ctx); 239 ls_item(sha1, base, pathname, mode, stage, walk_tree_ctx);
242 return 0; 240 return 0;
243} 241}
244 242
245
246/* 243/*
247 * Show a tree or a blob 244 * Show a tree or a blob
248 * rev: the commit pointing at the root tree object 245 * rev: the commit pointing at the root tree object