Numerous changes were made to git functions to use an object_id structure rather than sending sha1 hashes as raw unsigned character arrays. The functions that affect cgit are: parse_object, lookup_commit_reference, lookup_tag, lookup_tree, parse_tree_indirect, diff_root_tree_sha1, diff_tree_sha1, and format_display_notes. Commit b2141fc (config: don't include config.h by default) made it necessary to that config.h be explicitly included when needed. Commit 07a3d41 (grep: remove regflags from the public grep_opt API) removed one way of specifying the ignore-case grep option.
Unified · Split
| @@ -14,7 +14,7 @@ htmldir = $(docdir) · 13 unmodified lines | ||
| 14 | 14 | pdfdir = $(docdir) |
| 15 | 15 | mandir = $(prefix)/share/man |
| 16 | 16 | SHA1_HEADER = <openssl/sha.h> |
| 17 | −GIT_VER = 2.13.4 | |
| 17 | +GIT_VER = 2.14.0 | |
| 18 | 18 | GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz |
| 19 | 19 | INSTALL = install |
| 20 | 20 | COPYTREE = cp -r |
| @@ -1 +1 @@ | ||
| 1 | −Subproject commit cf8899d285d2648013040ec7196ffd3de0606664 | |
| 1 | +Subproject commit 4384e3cde2ce8ecd194202e171ae16333d241326 | |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include "scan-tree.h" |
| 11 | 11 | #include "configfile.h" |
| 12 | 12 | #include "html.h" |
| 13 | +#include "config.h" | |
| 13 | 14 | |
| 14 | 15 | /* return 1 if path contains a objects/ directory and a HEAD file */ |
| 15 | 16 | static int is_git_dir(const char *path) |
| @@ -48,7 +49,7 @@ out: · 32 unmodified lines | ||
| 48 | 49 | static struct cgit_repo *repo; |
| 49 | 50 | static repo_config_fn config_fn; |
| 50 | 51 | |
| 51 | −static void repo_config(const char *name, const char *value) | |
| 52 | +static void scan_tree_repo_config(const char *name, const char *value) | |
| 52 | 53 | { |
| 53 | 54 | config_fn(repo, name, value); |
| 54 | 55 | } |
| @@ -178,7 +179,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn) · 123 unmodified lines | ||
| 178 | 179 | |
| 179 | 180 | strbuf_addstr(path, "cgitrc"); |
| 180 | 181 | if (!stat(path->buf, &st)) |
| 181 | − parse_configfile(path->buf, &repo_config); | |
| 182 | + parse_configfile(path->buf, &scan_tree_repo_config); | |
| 182 | 183 | |
| 183 | 184 | strbuf_release(&rel); |
| 184 | 185 | } |
| @@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_ · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | ref = xmalloc(sizeof (struct refinfo)); |
| 162 | 162 | ref->refname = xstrdup(refname); |
| 163 | − ref->object = parse_object(oid->hash); | |
| 163 | + ref->object = parse_object(oid); | |
| 164 | 164 | switch (ref->object->type) { |
| 165 | 165 | case OBJ_TAG: |
| 166 | 166 | ref->tag = cgit_parse_tag((struct tag *)ref->object); |
| @@ -360,9 +360,9 @@ void cgit_diff_tree(const struct object_id *old_oid, · 193 unmodified lines | ||
| 360 | 360 | diff_setup_done(&opt); |
| 361 | 361 | |
| 362 | 362 | if (old_oid && !is_null_oid(old_oid)) |
| 363 | − diff_tree_sha1(old_oid->hash, new_oid->hash, "", &opt); | |
| 363 | + diff_tree_oid(old_oid, new_oid, "", &opt); | |
| 364 | 364 | else |
| 365 | − diff_root_tree_sha1(new_oid->hash, "", &opt); | |
| 365 | + diff_root_tree_oid(new_oid, "", &opt); | |
| 366 | 366 | diffcore_std(&opt); |
| 367 | 367 | diff_flush(&opt); |
| 368 | 368 | |
| @@ -56,7 +56,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only) · 55 unmodified lines | ||
| 56 | 56 | goto done; |
| 57 | 57 | if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT) |
| 58 | 58 | goto done; |
| 59 | − read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | |
| 59 | + read_tree_recursive(lookup_commit_reference(&oid)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | |
| 60 | 60 | |
| 61 | 61 | done: |
| 62 | 62 | free(path_items.match); |
| @@ -89,7 +89,7 @@ int cgit_print_file(char *path, const char *head, int file_only) · 26 unmodified lines | ||
| 89 | 89 | return -1; |
| 90 | 90 | type = sha1_object_info(oid.hash, &size); |
| 91 | 91 | if (type == OBJ_COMMIT) { |
| 92 | − commit = lookup_commit_reference(oid.hash); | |
| 92 | + commit = lookup_commit_reference(&oid); | |
| 93 | 93 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); |
| 94 | 94 | if (!walk_tree_ctx.found_path) |
| 95 | 95 | return -1; |
| @@ -145,7 +145,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl · 49 unmodified lines | ||
| 145 | 145 | type = sha1_object_info(oid.hash, &size); |
| 146 | 146 | |
| 147 | 147 | if ((!hex) && type == OBJ_COMMIT && path) { |
| 148 | − commit = lookup_commit_reference(oid.hash); | |
| 148 | + commit = lookup_commit_reference(&oid); | |
| 149 | 149 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); |
| 150 | 150 | type = sha1_object_info(oid.hash, &size); |
| 151 | 151 | } |
| @@ -17,7 +17,7 @@ static int print_ref_info(const char *refname, const struct object_id *oid, · 16 unmodified lines | ||
| 17 | 17 | { |
| 18 | 18 | struct object *obj; |
| 19 | 19 | |
| 20 | − if (!(obj = parse_object(oid->hash))) | |
| 20 | + if (!(obj = parse_object(oid))) | |
| 21 | 21 | return 0; |
| 22 | 22 | |
| 23 | 23 | htmlf("%s\t%s\n", oid_to_hex(oid), refname); |
| @@ -31,7 +31,7 @@ void cgit_print_commit(char *hex, const char *prefix) · 30 unmodified lines | ||
| 31 | 31 | "Bad object id: %s", hex); |
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | − commit = lookup_commit_reference(oid.hash); | |
| 34 | + commit = lookup_commit_reference(&oid); | |
| 35 | 35 | if (!commit) { |
| 36 | 36 | cgit_print_error_page(404, "Not found", |
| 37 | 37 | "Bad commit reference: %s", hex); |
| @@ -39,7 +39,7 @@ void cgit_print_commit(char *hex, const char *prefix) · 1 unmodified line | ||
| 39 | 39 | } |
| 40 | 40 | info = cgit_parse_commit(commit); |
| 41 | 41 | |
| 42 | − format_display_notes(oid.hash, ¬es, PAGE_ENCODING, 0); | |
| 42 | + format_display_notes(&oid, ¬es, PAGE_ENCODING, 0); | |
| 43 | 43 | |
| 44 | 44 | load_ref_decorations(DECORATE_FULL_REFS); |
| 45 | 45 | |
| @@ -87,7 +87,7 @@ void cgit_print_commit(char *hex, const char *prefix) · 41 unmodified lines | ||
| 87 | 87 | free(tmp); |
| 88 | 88 | html("</td></tr>\n"); |
| 89 | 89 | for (p = commit->parents; p; p = p->next) { |
| 90 | − parent = lookup_commit_reference(p->item->object.oid.hash); | |
| 90 | + parent = lookup_commit_reference(&p->item->object.oid); | |
| 91 | 91 | if (!parent) { |
| 92 | 92 | html("<tr><td colspan='3'>"); |
| 93 | 93 | cgit_print_error("Error reading parent commit"); |
| @@ -385,7 +385,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 384 unmodified lines | ||
| 385 | 385 | const char *prefix, int show_ctrls, int raw) |
| 386 | 386 | { |
| 387 | 387 | struct commit *commit, *commit2; |
| 388 | − const unsigned char *old_tree_sha1, *new_tree_sha1; | |
| 388 | + const struct object_id *old_tree_oid, *new_tree_oid; | |
| 389 | 389 | diff_type difftype; |
| 390 | 390 | |
| 391 | 391 | /* |
| @@ -407,13 +407,13 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 15 unmodified lines | ||
| 407 | 407 | "Bad object name: %s", new_rev); |
| 408 | 408 | return; |
| 409 | 409 | } |
| 410 | − commit = lookup_commit_reference(new_rev_oid->hash); | |
| 410 | + commit = lookup_commit_reference(new_rev_oid); | |
| 411 | 411 | if (!commit || parse_commit(commit)) { |
| 412 | 412 | cgit_print_error_page(404, "Not found", |
| 413 | 413 | "Bad commit: %s", oid_to_hex(new_rev_oid)); |
| 414 | 414 | return; |
| 415 | 415 | } |
| 416 | − new_tree_sha1 = commit->tree->object.oid.hash; | |
| 416 | + new_tree_oid = &commit->tree->object.oid; | |
| 417 | 417 | |
| 418 | 418 | if (old_rev) { |
| 419 | 419 | if (get_oid(old_rev, old_rev_oid)) { |
| @@ -428,15 +428,15 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 8 unmodified lines | ||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | if (!is_null_oid(old_rev_oid)) { |
| 431 | − commit2 = lookup_commit_reference(old_rev_oid->hash); | |
| 431 | + commit2 = lookup_commit_reference(old_rev_oid); | |
| 432 | 432 | if (!commit2 || parse_commit(commit2)) { |
| 433 | 433 | cgit_print_error_page(404, "Not found", |
| 434 | 434 | "Bad commit: %s", oid_to_hex(old_rev_oid)); |
| 435 | 435 | return; |
| 436 | 436 | } |
| 437 | − old_tree_sha1 = commit2->tree->object.oid.hash; | |
| 437 | + old_tree_oid = &commit2->tree->object.oid; | |
| 438 | 438 | } else { |
| 439 | − old_tree_sha1 = NULL; | |
| 439 | + old_tree_oid = NULL; | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | if (raw) { |
| @@ -449,11 +449,11 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 6 unmodified lines | ||
| 449 | 449 | |
| 450 | 450 | ctx.page.mimetype = "text/plain"; |
| 451 | 451 | cgit_print_http_headers(); |
| 452 | − if (old_tree_sha1) { | |
| 453 | − diff_tree_sha1(old_tree_sha1, new_tree_sha1, "", | |
| 452 | + if (old_tree_oid) { | |
| 453 | + diff_tree_oid(old_tree_oid, new_tree_oid, "", | |
| 454 | 454 | &diffopt); |
| 455 | 455 | } else { |
| 456 | − diff_root_tree_sha1(new_tree_sha1, "", &diffopt); | |
| 456 | + diff_root_tree_oid(new_tree_oid, "", &diffopt); | |
| 457 | 457 | } |
| 458 | 458 | diffcore_std(&diffopt); |
| 459 | 459 | diff_flush(&diffopt); |
| @@ -150,9 +150,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs) · 149 unmodified lines | ||
| 150 | 150 | rem_lines = 0; |
| 151 | 151 | |
| 152 | 152 | DIFF_OPT_SET(&revs->diffopt, RECURSIVE); |
| 153 | − diff_tree_sha1(parent->tree->object.oid.hash, | |
| 154 | − commit->tree->object.oid.hash, | |
| 155 | − "", &revs->diffopt); | |
| 153 | + diff_tree_oid(&parent->tree->object.oid, | |
| 154 | + &commit->tree->object.oid, | |
| 155 | + "", &revs->diffopt); | |
| 156 | 156 | diffcore_std(&revs->diffopt); |
| 157 | 157 | |
| 158 | 158 | found = !diff_queue_is_empty(); |
| @@ -273,7 +273,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) · 114 unmodified lines | ||
| 273 | 273 | strbuf_addstr(&msgbuf, info->msg); |
| 274 | 274 | strbuf_addch(&msgbuf, '\n'); |
| 275 | 275 | } |
| 276 | − format_display_notes(commit->object.oid.hash, | |
| 276 | + format_display_notes(&commit->object.oid, | |
| 277 | 277 | &msgbuf, PAGE_ENCODING, 0); |
| 278 | 278 | strbuf_addch(&msgbuf, '\n'); |
| 279 | 279 | strbuf_ltrim(&msgbuf); |
| @@ -436,7 +436,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern · 156 unmodified lines | ||
| 436 | 436 | setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL); |
| 437 | 437 | load_ref_decorations(DECORATE_FULL_REFS); |
| 438 | 438 | rev.show_decorations = 1; |
| 439 | − rev.grep_filter.regflags |= REG_ICASE; | |
| 439 | + rev.grep_filter.ignore_case = 1; | |
| 440 | 440 | |
| 441 | 441 | rev.diffopt.detect_rename = 1; |
| 442 | 442 | rev.diffopt.rename_limit = ctx.cfg.renamelimit; |
| @@ -33,7 +33,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, · 32 unmodified lines | ||
| 33 | 33 | "Bad object id: %s", new_rev); |
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | − commit = lookup_commit_reference(new_rev_oid.hash); | |
| 36 | + commit = lookup_commit_reference(&new_rev_oid); | |
| 37 | 37 | if (!commit) { |
| 38 | 38 | cgit_print_error_page(404, "Not found", |
| 39 | 39 | "Bad commit reference: %s", new_rev); |
| @@ -46,7 +46,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, · 6 unmodified lines | ||
| 46 | 46 | "Bad object id: %s", old_rev); |
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | − if (!lookup_commit_reference(old_rev_oid.hash)) { | |
| 49 | + if (!lookup_commit_reference(&old_rev_oid)) { | |
| 50 | 50 | cgit_print_error_page(404, "Not found", |
| 51 | 51 | "Bad commit reference: %s", old_rev); |
| 52 | 52 | return; |
| @@ -185,7 +185,7 @@ void cgit_print_plain(void) · 184 unmodified lines | ||
| 185 | 185 | cgit_print_error_page(404, "Not found", "Not found"); |
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | − commit = lookup_commit_reference(oid.hash); | |
| 188 | + commit = lookup_commit_reference(&oid); | |
| 189 | 189 | if (!commit || parse_commit(commit)) { |
| 190 | 190 | cgit_print_error_page(404, "Not found", "Not found"); |
| 191 | 191 | return; |
| @@ -116,7 +116,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format, · 115 unmodified lines | ||
| 116 | 116 | "Bad object id: %s", hex); |
| 117 | 117 | return 1; |
| 118 | 118 | } |
| 119 | − if (!lookup_commit_reference(oid.hash)) { | |
| 119 | + if (!lookup_commit_reference(&oid)) { | |
| 120 | 120 | cgit_print_error_page(400, "Bad request", |
| 121 | 121 | "Not a commit reference: %s", hex); |
| 122 | 122 | return 1; |
| @@ -54,7 +54,7 @@ void cgit_print_tag(char *revname) · 53 unmodified lines | ||
| 54 | 54 | "Bad tag reference: %s", revname); |
| 55 | 55 | goto cleanup; |
| 56 | 56 | } |
| 57 | − obj = parse_object(oid.hash); | |
| 57 | + obj = parse_object(&oid); | |
| 58 | 58 | if (!obj) { |
| 59 | 59 | cgit_print_error_page(500, "Internal server error", |
| 60 | 60 | "Bad object id: %s", oid_to_hex(&oid)); |
| @@ -64,7 +64,7 @@ void cgit_print_tag(char *revname) · 3 unmodified lines | ||
| 64 | 64 | struct tag *tag; |
| 65 | 65 | struct taginfo *info; |
| 66 | 66 | |
| 67 | − tag = lookup_tag(oid.hash); | |
| 67 | + tag = lookup_tag(&oid); | |
| 68 | 68 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { |
| 69 | 69 | cgit_print_error_page(500, "Internal server error", |
| 70 | 70 | "Bad tag object: %s", revname); |
| @@ -157,7 +157,7 @@ static void print_object(const unsigned char *sha1, char *path, const char *base · 156 unmodified lines | ||
| 157 | 157 | |
| 158 | 158 | struct single_tree_ctx { |
| 159 | 159 | struct strbuf *path; |
| 160 | − unsigned char sha1[GIT_SHA1_RAWSZ]; | |
| 160 | + struct object_id oid; | |
| 161 | 161 | char *name; |
| 162 | 162 | size_t count; |
| 163 | 163 | }; |
| @@ -177,7 +177,7 @@ static int single_tree_cb(const unsigned char *sha1, struct strbuf *base, · 13 unmodified lines | ||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | ctx->name = xstrdup(pathname); |
| 180 | − hashcpy(ctx->sha1, sha1); | |
| 180 | + hashcpy(ctx->oid.hash, sha1); | |
| 181 | 181 | strbuf_addf(ctx->path, "/%s", pathname); |
| 182 | 182 | return 0; |
| 183 | 183 | } |
| @@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name, · 11 unmodified lines | ||
| 195 | 195 | .nr = 0 |
| 196 | 196 | }; |
| 197 | 197 | |
| 198 | − hashcpy(tree_ctx.sha1, sha1); | |
| 198 | + hashcpy(tree_ctx.oid.hash, sha1); | |
| 199 | 199 | |
| 200 | 200 | while (tree_ctx.count == 1) { |
| 201 | 201 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, |
| 202 | 202 | fullpath->buf); |
| 203 | 203 | |
| 204 | − tree = lookup_tree(tree_ctx.sha1); | |
| 204 | + tree = lookup_tree(&tree_ctx.oid); | |
| 205 | 205 | if (!tree) |
| 206 | 206 | return; |
| 207 | 207 | |
| @@ -300,17 +300,17 @@ static void ls_tail(void) · 92 unmodified lines | ||
| 300 | 300 | cgit_print_layout_end(); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | −static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx) | |
| 303 | +static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx) | |
| 304 | 304 | { |
| 305 | 305 | struct tree *tree; |
| 306 | 306 | struct pathspec paths = { |
| 307 | 307 | .nr = 0 |
| 308 | 308 | }; |
| 309 | 309 | |
| 310 | − tree = parse_tree_indirect(sha1); | |
| 310 | + tree = parse_tree_indirect(oid); | |
| 311 | 311 | if (!tree) { |
| 312 | 312 | cgit_print_error_page(404, "Not found", |
| 313 | − "Not a tree object: %s", sha1_to_hex(sha1)); | |
| 313 | + "Not a tree object: %s", sha1_to_hex(oid->hash)); | |
| 314 | 314 | return; |
| 315 | 315 | } |
| 316 | 316 | |
| @@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path) · 63 unmodified lines | ||
| 380 | 380 | "Invalid revision name: %s", rev); |
| 381 | 381 | return; |
| 382 | 382 | } |
| 383 | − commit = lookup_commit_reference(oid.hash); | |
| 383 | + commit = lookup_commit_reference(&oid); | |
| 384 | 384 | if (!commit || parse_commit(commit)) { |
| 385 | 385 | cgit_print_error_page(404, "Not found", |
| 386 | 386 | "Invalid commit reference: %s", rev); |
| @@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path) · 3 unmodified lines | ||
| 390 | 390 | walk_tree_ctx.curr_rev = xstrdup(rev); |
| 391 | 391 | |
| 392 | 392 | if (path == NULL) { |
| 393 | − ls_tree(commit->tree->object.oid.hash, NULL, &walk_tree_ctx); | |
| 393 | + ls_tree(&commit->tree->object.oid, NULL, &walk_tree_ctx); | |
| 394 | 394 | goto cleanup; |
| 395 | 395 | } |
| 396 | 396 | |