summaryrefslogtreecommitdiffabout
authorLars Hjemli <larsh@hatman.(none)>2008-07-21 08:10:48 (UTC)
committer Lars Hjemli <larsh@hatman.(none)>2008-07-21 08:10:48 (UTC)
commit566f92b27618f67f59cc3642e17d9cb9c12634fa (patch) (unidiff)
tree3945996da0cce9a348a803d91c87df4e303c178b
parentd2eb4fddb0fb7cd1751debcff6fe1219b9c619c8 (diff)
downloadcgit-566f92b27618f67f59cc3642e17d9cb9c12634fa.zip
cgit-566f92b27618f67f59cc3642e17d9cb9c12634fa.tar.gz
cgit-566f92b27618f67f59cc3642e17d9cb9c12634fa.tar.bz2
Adjust to new calling convention for read_tree_recursive()
In GIT-1.6.0, read_tree_recursive takes an extra void pointer for callback data. We might want to use this to avoid some global variables, but for now lets just make sure that we can still compile. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-blob.c5
-rw-r--r--ui-tree.c12
2 files changed, 10 insertions, 7 deletions
diff --git a/ui-blob.c b/ui-blob.c
index 73a8c1d..3cda03d 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -13,7 +13,8 @@
13static char *match_path; 13static char *match_path;
14static unsigned char *matched_sha1; 14static unsigned char *matched_sha1;
15 15
16static int walk_tree(const unsigned char *sha1, const char *base,int baselen, const char *pathname, unsigned mode, int stage) { 16static int walk_tree(const unsigned char *sha1, const char *base,int baselen,
17 const char *pathname, unsigned mode, int stage, void *cbdata) {
17 if(strncmp(base,match_path,baselen) 18 if(strncmp(base,match_path,baselen)
18 || strcmp(match_path+baselen,pathname) ) 19 || strcmp(match_path+baselen,pathname) )
19 return READ_TREE_RECURSIVE; 20 return READ_TREE_RECURSIVE;
@@ -49,7 +50,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
49 commit = lookup_commit_reference(sha1); 50 commit = lookup_commit_reference(sha1);
50 match_path = path; 51 match_path = path;
51 matched_sha1 = sha1; 52 matched_sha1 = sha1;
52 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree); 53 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL);
53 type = sha1_object_info(sha1,&size); 54 type = sha1_object_info(sha1,&size);
54 } 55 }
55 56
diff --git a/ui-tree.c b/ui-tree.c
index 5a2dd3f..9a837e2 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -62,7 +62,8 @@ static void print_object(const unsigned char *sha1, char *path)
62 62
63 63
64static int ls_item(const unsigned char *sha1, const char *base, int baselen, 64static int ls_item(const unsigned char *sha1, const char *base, int baselen,
65 const char *pathname, unsigned int mode, int stage) 65 const char *pathname, unsigned int mode, int stage,
66 void *cbdata)
66{ 67{
67 char *name; 68 char *name;
68 char *fullpath; 69 char *fullpath;
@@ -143,13 +144,14 @@ static void ls_tree(const unsigned char *sha1, char *path)
143 } 144 }
144 145
145 ls_head(); 146 ls_head();
146 read_tree_recursive(tree, "", 0, 1, NULL, ls_item); 147 read_tree_recursive(tree, "", 0, 1, NULL, ls_item, NULL);
147 ls_tail(); 148 ls_tail();
148} 149}
149 150
150 151
151static int walk_tree(const unsigned char *sha1, const char *base, int baselen, 152static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
152 const char *pathname, unsigned mode, int stage) 153 const char *pathname, unsigned mode, int stage,
154 void *cbdata)
153{ 155{
154 static int state; 156 static int state;
155 static char buffer[PATH_MAX]; 157 static char buffer[PATH_MAX];
@@ -176,7 +178,7 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
176 return 0; 178 return 0;
177 } 179 }
178 } 180 }
179 ls_item(sha1, base, baselen, pathname, mode, stage); 181 ls_item(sha1, base, baselen, pathname, mode, stage, NULL);
180 return 0; 182 return 0;
181} 183}
182 184
@@ -216,6 +218,6 @@ void cgit_print_tree(const char *rev, char *path)
216 } 218 }
217 219
218 match_path = path; 220 match_path = path;
219 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree); 221 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL);
220 ls_tail(); 222 ls_tail();
221} 223}