History

git: update to v2.14

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.

Jeff Smith committed 9 years ago

Commit d08d6fc1 parent 3d33b4614 files · +44 −43Browse files

Unified · Split

14 files
  1. Makefile +1 −1
  2. git +1 −1
  3. scan-tree.c +3 −2
  4. shared.c +3 −3
  5. ui-blob.c +3 −3
  6. ui-clone.c +1 −1
  7. ui-commit.c +3 −3
  8. ui-diff.c +9 −9
  9. ui-log.c +5 −5
  10. ui-patch.c +2 −2
  11. ui-plain.c +1 −1
  12. ui-snapshot.c +1 −1
  13. ui-tag.c +2 −2
  14. ui-tree.c +9 −9
Makefile+1−1
@@ -14,7 +14,7 @@ htmldir = $(docdir) · 13 unmodified lines
1414 pdfdir = $(docdir)
1515 mandir = $(prefix)/share/man
1616 SHA1_HEADER = <openssl/sha.h>
17−GIT_VER = 2.13.4
17+GIT_VER = 2.14.0
1818 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
1919 INSTALL = install
2020 COPYTREE = cp -r
git+1−1
@@ -1 +1 @@
1−Subproject commit cf8899d285d2648013040ec7196ffd3de0606664
1+Subproject commit 4384e3cde2ce8ecd194202e171ae16333d241326
scan-tree.c+3−2
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include "scan-tree.h"
1111 #include "configfile.h"
1212 #include "html.h"
13+#include "config.h"
1314
1415 /* return 1 if path contains a objects/ directory and a HEAD file */
1516 static int is_git_dir(const char *path)
@@ -48,7 +49,7 @@ out: · 32 unmodified lines
4849 static struct cgit_repo *repo;
4950 static repo_config_fn config_fn;
5051
51−static void repo_config(const char *name, const char *value)
52+static void scan_tree_repo_config(const char *name, const char *value)
5253 {
5354 config_fn(repo, name, value);
5455 }
@@ -178,7 +179,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn) · 123 unmodified lines
178179
179180 strbuf_addstr(path, "cgitrc");
180181 if (!stat(path->buf, &st))
181− parse_configfile(path->buf, &repo_config);
182+ parse_configfile(path->buf, &scan_tree_repo_config);
182183
183184 strbuf_release(&rel);
184185 }
shared.c+3−3
@@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_ · 159 unmodified lines
160160
161161 ref = xmalloc(sizeof (struct refinfo));
162162 ref->refname = xstrdup(refname);
163− ref->object = parse_object(oid->hash);
163+ ref->object = parse_object(oid);
164164 switch (ref->object->type) {
165165 case OBJ_TAG:
166166 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
360360 diff_setup_done(&opt);
361361
362362 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);
364364 else
365− diff_root_tree_sha1(new_oid->hash, "", &opt);
365+ diff_root_tree_oid(new_oid, "", &opt);
366366 diffcore_std(&opt);
367367 diff_flush(&opt);
368368
ui-blob.c+3−3
@@ -56,7 +56,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only) · 55 unmodified lines
5656 goto done;
5757 if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
5858 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);
6060
6161 done:
6262 free(path_items.match);
@@ -89,7 +89,7 @@ int cgit_print_file(char *path, const char *head, int file_only) · 26 unmodified lines
8989 return -1;
9090 type = sha1_object_info(oid.hash, &size);
9191 if (type == OBJ_COMMIT) {
92− commit = lookup_commit_reference(oid.hash);
92+ commit = lookup_commit_reference(&oid);
9393 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
9494 if (!walk_tree_ctx.found_path)
9595 return -1;
@@ -145,7 +145,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl · 49 unmodified lines
145145 type = sha1_object_info(oid.hash, &size);
146146
147147 if ((!hex) && type == OBJ_COMMIT && path) {
148− commit = lookup_commit_reference(oid.hash);
148+ commit = lookup_commit_reference(&oid);
149149 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
150150 type = sha1_object_info(oid.hash, &size);
151151 }
ui-clone.c+1−1
@@ -17,7 +17,7 @@ static int print_ref_info(const char *refname, const struct object_id *oid, · 16 unmodified lines
1717 {
1818 struct object *obj;
1919
20− if (!(obj = parse_object(oid->hash)))
20+ if (!(obj = parse_object(oid)))
2121 return 0;
2222
2323 htmlf("%s\t%s\n", oid_to_hex(oid), refname);
ui-commit.c+3−3
@@ -31,7 +31,7 @@ void cgit_print_commit(char *hex, const char *prefix) · 30 unmodified lines
3131 "Bad object id: %s", hex);
3232 return;
3333 }
34− commit = lookup_commit_reference(oid.hash);
34+ commit = lookup_commit_reference(&oid);
3535 if (!commit) {
3636 cgit_print_error_page(404, "Not found",
3737 "Bad commit reference: %s", hex);
@@ -39,7 +39,7 @@ void cgit_print_commit(char *hex, const char *prefix) · 1 unmodified line
3939 }
4040 info = cgit_parse_commit(commit);
4141
42− format_display_notes(oid.hash, &notes, PAGE_ENCODING, 0);
42+ format_display_notes(&oid, &notes, PAGE_ENCODING, 0);
4343
4444 load_ref_decorations(DECORATE_FULL_REFS);
4545
@@ -87,7 +87,7 @@ void cgit_print_commit(char *hex, const char *prefix) · 41 unmodified lines
8787 free(tmp);
8888 html("</td></tr>\n");
8989 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);
9191 if (!parent) {
9292 html("<tr><td colspan='3'>");
9393 cgit_print_error("Error reading parent commit");
ui-diff.c+9−9
@@ -385,7 +385,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 384 unmodified lines
385385 const char *prefix, int show_ctrls, int raw)
386386 {
387387 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;
389389 diff_type difftype;
390390
391391 /*
@@ -407,13 +407,13 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 15 unmodified lines
407407 "Bad object name: %s", new_rev);
408408 return;
409409 }
410− commit = lookup_commit_reference(new_rev_oid->hash);
410+ commit = lookup_commit_reference(new_rev_oid);
411411 if (!commit || parse_commit(commit)) {
412412 cgit_print_error_page(404, "Not found",
413413 "Bad commit: %s", oid_to_hex(new_rev_oid));
414414 return;
415415 }
416− new_tree_sha1 = commit->tree->object.oid.hash;
416+ new_tree_oid = &commit->tree->object.oid;
417417
418418 if (old_rev) {
419419 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
428428 }
429429
430430 if (!is_null_oid(old_rev_oid)) {
431− commit2 = lookup_commit_reference(old_rev_oid->hash);
431+ commit2 = lookup_commit_reference(old_rev_oid);
432432 if (!commit2 || parse_commit(commit2)) {
433433 cgit_print_error_page(404, "Not found",
434434 "Bad commit: %s", oid_to_hex(old_rev_oid));
435435 return;
436436 }
437− old_tree_sha1 = commit2->tree->object.oid.hash;
437+ old_tree_oid = &commit2->tree->object.oid;
438438 } else {
439− old_tree_sha1 = NULL;
439+ old_tree_oid = NULL;
440440 }
441441
442442 if (raw) {
@@ -449,11 +449,11 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, · 6 unmodified lines
449449
450450 ctx.page.mimetype = "text/plain";
451451 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, "",
454454 &diffopt);
455455 } else {
456− diff_root_tree_sha1(new_tree_sha1, "", &diffopt);
456+ diff_root_tree_oid(new_tree_oid, "", &diffopt);
457457 }
458458 diffcore_std(&diffopt);
459459 diff_flush(&diffopt);
ui-log.c+5−5
@@ -150,9 +150,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs) · 149 unmodified lines
150150 rem_lines = 0;
151151
152152 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);
156156 diffcore_std(&revs->diffopt);
157157
158158 found = !diff_queue_is_empty();
@@ -273,7 +273,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) · 114 unmodified lines
273273 strbuf_addstr(&msgbuf, info->msg);
274274 strbuf_addch(&msgbuf, '\n');
275275 }
276− format_display_notes(commit->object.oid.hash,
276+ format_display_notes(&commit->object.oid,
277277 &msgbuf, PAGE_ENCODING, 0);
278278 strbuf_addch(&msgbuf, '\n');
279279 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
436436 setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);
437437 load_ref_decorations(DECORATE_FULL_REFS);
438438 rev.show_decorations = 1;
439− rev.grep_filter.regflags |= REG_ICASE;
439+ rev.grep_filter.ignore_case = 1;
440440
441441 rev.diffopt.detect_rename = 1;
442442 rev.diffopt.rename_limit = ctx.cfg.renamelimit;
ui-patch.c+2−2
@@ -33,7 +33,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, · 32 unmodified lines
3333 "Bad object id: %s", new_rev);
3434 return;
3535 }
36− commit = lookup_commit_reference(new_rev_oid.hash);
36+ commit = lookup_commit_reference(&new_rev_oid);
3737 if (!commit) {
3838 cgit_print_error_page(404, "Not found",
3939 "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
4646 "Bad object id: %s", old_rev);
4747 return;
4848 }
49− if (!lookup_commit_reference(old_rev_oid.hash)) {
49+ if (!lookup_commit_reference(&old_rev_oid)) {
5050 cgit_print_error_page(404, "Not found",
5151 "Bad commit reference: %s", old_rev);
5252 return;
ui-plain.c+1−1
@@ -185,7 +185,7 @@ void cgit_print_plain(void) · 184 unmodified lines
185185 cgit_print_error_page(404, "Not found", "Not found");
186186 return;
187187 }
188− commit = lookup_commit_reference(oid.hash);
188+ commit = lookup_commit_reference(&oid);
189189 if (!commit || parse_commit(commit)) {
190190 cgit_print_error_page(404, "Not found", "Not found");
191191 return;
ui-snapshot.c+1−1
@@ -116,7 +116,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format, · 115 unmodified lines
116116 "Bad object id: %s", hex);
117117 return 1;
118118 }
119− if (!lookup_commit_reference(oid.hash)) {
119+ if (!lookup_commit_reference(&oid)) {
120120 cgit_print_error_page(400, "Bad request",
121121 "Not a commit reference: %s", hex);
122122 return 1;
ui-tag.c+2−2
@@ -54,7 +54,7 @@ void cgit_print_tag(char *revname) · 53 unmodified lines
5454 "Bad tag reference: %s", revname);
5555 goto cleanup;
5656 }
57− obj = parse_object(oid.hash);
57+ obj = parse_object(&oid);
5858 if (!obj) {
5959 cgit_print_error_page(500, "Internal server error",
6060 "Bad object id: %s", oid_to_hex(&oid));
@@ -64,7 +64,7 @@ void cgit_print_tag(char *revname) · 3 unmodified lines
6464 struct tag *tag;
6565 struct taginfo *info;
6666
67− tag = lookup_tag(oid.hash);
67+ tag = lookup_tag(&oid);
6868 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
6969 cgit_print_error_page(500, "Internal server error",
7070 "Bad tag object: %s", revname);
ui-tree.c+9−9
@@ -157,7 +157,7 @@ static void print_object(const unsigned char *sha1, char *path, const char *base · 156 unmodified lines
157157
158158 struct single_tree_ctx {
159159 struct strbuf *path;
160− unsigned char sha1[GIT_SHA1_RAWSZ];
160+ struct object_id oid;
161161 char *name;
162162 size_t count;
163163 };
@@ -177,7 +177,7 @@ static int single_tree_cb(const unsigned char *sha1, struct strbuf *base, · 13 unmodified lines
177177 }
178178
179179 ctx->name = xstrdup(pathname);
180− hashcpy(ctx->sha1, sha1);
180+ hashcpy(ctx->oid.hash, sha1);
181181 strbuf_addf(ctx->path, "/%s", pathname);
182182 return 0;
183183 }
@@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name, · 11 unmodified lines
195195 .nr = 0
196196 };
197197
198− hashcpy(tree_ctx.sha1, sha1);
198+ hashcpy(tree_ctx.oid.hash, sha1);
199199
200200 while (tree_ctx.count == 1) {
201201 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
202202 fullpath->buf);
203203
204− tree = lookup_tree(tree_ctx.sha1);
204+ tree = lookup_tree(&tree_ctx.oid);
205205 if (!tree)
206206 return;
207207
@@ -300,17 +300,17 @@ static void ls_tail(void) · 92 unmodified lines
300300 cgit_print_layout_end();
301301 }
302302
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)
304304 {
305305 struct tree *tree;
306306 struct pathspec paths = {
307307 .nr = 0
308308 };
309309
310− tree = parse_tree_indirect(sha1);
310+ tree = parse_tree_indirect(oid);
311311 if (!tree) {
312312 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));
314314 return;
315315 }
316316
@@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path) · 63 unmodified lines
380380 "Invalid revision name: %s", rev);
381381 return;
382382 }
383− commit = lookup_commit_reference(oid.hash);
383+ commit = lookup_commit_reference(&oid);
384384 if (!commit || parse_commit(commit)) {
385385 cgit_print_error_page(404, "Not found",
386386 "Invalid commit reference: %s", rev);
@@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path) · 3 unmodified lines
390390 walk_tree_ctx.curr_rev = xstrdup(rev);
391391
392392 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);
394394 goto cleanup;
395395 }
396396