about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJohn Keeping2013-03-02 12:32:11 +0000
committerJason A. Donenfeld2013-03-02 10:38:03 -0500
commitc1633c6befb6762e1ac9434a29980e4df5ffee21 (patch)
tree20dbdeab1f74e138a7db58a7ffb9ce304dcf3146
parentUpdate git to v1.7.5.4 (diff)
downloadcgit-c1633c6befb6762e1ac9434a29980e4df5ffee21.tar.gz
cgit-c1633c6befb6762e1ac9434a29980e4df5ffee21.zip
Update git to v1.7.6.5
struct pathspec is now used in more places.

Signed-off-by: John Keeping <john@keeping.me.uk>
m---------git0
-rw-r--r--ui-blob.c22
-rw-r--r--ui-plain.c17
-rw-r--r--ui-tree.c16
4 files changed, 43 insertions, 12 deletions
diff --git a/git b/git
Subproject e5af0de202e885b793482d416b8ce9d50dd2b8b Subproject 15b7898c5e9fc6fed9a6064213cfcd08cf7d731
diff --git a/ui-blob.c b/ui-blob.c index ec435e1..3de4473 100644 --- a/ui-blob.c +++ b/ui-blob.c
@@ -32,7 +32,14 @@ int cgit_print_file(char *path, const char *head)
32 char *buf; 32 char *buf;
33 unsigned long size; 33 unsigned long size;
34 struct commit *commit; 34 struct commit *commit;
35 const char *paths[] = {path, NULL}; 35 struct pathspec_item path_items = {
36 .match = path,
37 .len = strlen(path)
38 };
39 struct pathspec paths = {
40 .nr = 1,
41 .items = &path_items
42 };
36 if (get_sha1(head, sha1)) 43 if (get_sha1(head, sha1))
37 return -1; 44 return -1;
38 type = sha1_object_info(sha1, &size); 45 type = sha1_object_info(sha1, &size);
@@ -41,7 +48,7 @@ int cgit_print_file(char *path, const char *head)
41 match_path = path; 48 match_path = path;
42 matched_sha1 = sha1; 49 matched_sha1 = sha1;
43 found_path = 0; 50 found_path = 0;
44 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); 51 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL);
45 if (!found_path) 52 if (!found_path)
46 return -1; 53 return -1;
47 type = sha1_object_info(sha1, &size); 54 type = sha1_object_info(sha1, &size);
@@ -63,7 +70,14 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
63 char *buf; 70 char *buf;
64 unsigned long size; 71 unsigned long size;
65 struct commit *commit; 72 struct commit *commit;
66 const char *paths[] = {path, NULL}; 73 struct pathspec_item path_items = {
74 .match = path,
75 .len = strlen(path)
76 };
77 struct pathspec paths = {
78 .nr = 1,
79 .items = &path_items
80 };
67 81
68 if (hex) { 82 if (hex) {
69 if (get_sha1_hex(hex, sha1)){ 83 if (get_sha1_hex(hex, sha1)){
@@ -83,7 +97,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
83 commit = lookup_commit_reference(sha1); 97 commit = lookup_commit_reference(sha1);
84 match_path = path; 98 match_path = path;
85 matched_sha1 = sha1; 99 matched_sha1 = sha1;
86 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); 100 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL);
87 type = sha1_object_info(sha1,&size); 101 type = sha1_object_info(sha1,&size);
88 } 102 }
89 103
diff --git a/ui-plain.c b/ui-plain.c index 85877d7..c21d38f 100644 --- a/ui-plain.c +++ b/ui-plain.c
@@ -197,7 +197,14 @@ void cgit_print_plain(struct cgit_context *ctx)
197 const char *rev = ctx->qry.sha1; 197 const char *rev = ctx->qry.sha1;
198 unsigned char sha1[20]; 198 unsigned char sha1[20];
199 struct commit *commit; 199 struct commit *commit;
200 const char *paths[] = {ctx->qry.path, NULL}; 200 struct pathspec_item path_items = {
201 .match = ctx->qry.path,
202 .len = ctx->qry.path ? strlen(ctx->qry.path) : 0
203 };
204 struct pathspec paths = {
205 .nr = 1,
206 .items = &path_items
207 };
201 208
202 if (!rev) 209 if (!rev)
203 rev = ctx->qry.head; 210 rev = ctx->qry.head;
@@ -211,14 +218,14 @@ void cgit_print_plain(struct cgit_context *ctx)
211 html_status(404, "Not found", 0); 218 html_status(404, "Not found", 0);
212 return; 219 return;
213 } 220 }
214 if (!paths[0]) { 221 if (!path_items.match) {
215 paths[0] = ""; 222 path_items.match = "";
216 match_baselen = -1; 223 match_baselen = -1;
217 print_dir(commit->tree->object.sha1, "", 0, ""); 224 print_dir(commit->tree->object.sha1, "", 0, "");
218 } 225 }
219 else 226 else
220 match_baselen = basedir_len(paths[0]); 227 match_baselen = basedir_len(path_items.match);
221 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); 228 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL);
222 if (!match) 229 if (!match)
223 html_status(404, "Not found", 0); 230 html_status(404, "Not found", 0);
224 else if (match == 2) 231 else if (match == 2)
diff --git a/ui-tree.c b/ui-tree.c index b1adcc7..b544440 100644 --- a/ui-tree.c +++ b/ui-tree.c
@@ -202,6 +202,9 @@ static void ls_tail()
202static void ls_tree(const unsigned char *sha1, char *path) 202static void ls_tree(const unsigned char *sha1, char *path)
203{ 203{
204 struct tree *tree; 204 struct tree *tree;
205 struct pathspec paths = {
206 .nr = 0
207 };
205 208
206 tree = parse_tree_indirect(sha1); 209 tree = parse_tree_indirect(sha1);
207 if (!tree) { 210 if (!tree) {
@@ -211,7 +214,7 @@ static void ls_tree(const unsigned char *sha1, char *path)
211 } 214 }
212 215
213 ls_head(); 216 ls_head();
214 read_tree_recursive(tree, "", 0, 1, NULL, ls_item, NULL); 217 read_tree_recursive(tree, "", 0, 1, &paths, ls_item, NULL);
215 ls_tail(); 218 ls_tail();
216} 219}
217 220
@@ -252,7 +255,14 @@ void cgit_print_tree(const char *rev, char *path)
252{ 255{
253 unsigned char sha1[20]; 256 unsigned char sha1[20];
254 struct commit *commit; 257 struct commit *commit;
255 const char *paths[] = {path, NULL}; 258 struct pathspec_item path_items = {
259 .match = path,
260 .len = path ? strlen(path) : 0
261 };
262 struct pathspec paths = {
263 .nr = path ? 1 : 0,
264 .items = &path_items
265 };
256 266
257 if (!rev) 267 if (!rev)
258 rev = ctx.qry.head; 268 rev = ctx.qry.head;
@@ -274,6 +284,6 @@ void cgit_print_tree(const char *rev, char *path)
274 } 284 }
275 285
276 match_path = path; 286 match_path = path;
277 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); 287 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL);
278 ls_tail(); 288 ls_tail();
279} 289}