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
14pdfdir = $(docdir)14pdfdir = $(docdir)
15mandir = $(prefix)/share/man15mandir = $(prefix)/share/man
16SHA1_HEADER = <openssl/sha.h>16SHA1_HEADER = <openssl/sha.h>
17GIT_VER = 2.13.417GIT_VER = 2.14.0
18GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz18GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
19INSTALL = install19INSTALL = install
20COPYTREE = cp -r20COPYTREE = cp -r
git+1−1
@@ -1 +1 @@
1Subproject commit cf8899d285d2648013040ec7196ffd3de06066641Subproject commit 4384e3cde2ce8ecd194202e171ae16333d241326
scan-tree.c+3−2
@@ -10,6 +10,7 @@ · 9 unmodified lines
10#include "scan-tree.h"10#include "scan-tree.h"
11#include "configfile.h"11#include "configfile.h"
12#include "html.h"12#include "html.h"
13#include "config.h"
13 14
14/* return 1 if path contains a objects/ directory and a HEAD file */15/* return 1 if path contains a objects/ directory and a HEAD file */
15static int is_git_dir(const char *path)16static int is_git_dir(const char *path)
@@ -48,7 +49,7 @@ out: · 32 unmodified lines
48static struct cgit_repo *repo;49static struct cgit_repo *repo;
49static repo_config_fn config_fn;50static repo_config_fn config_fn;
50 51
51static void repo_config(const char *name, const char *value)52static void scan_tree_repo_config(const char *name, const char *value)
52{53{
53 config_fn(repo, name, value);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 strbuf_addstr(path, "cgitrc");180 strbuf_addstr(path, "cgitrc");
180 if (!stat(path->buf, &st))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 strbuf_release(&rel);184 strbuf_release(&rel);
184}185}
shared.c+3−3
@@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_ · 159 unmodified lines
160 160
161 ref = xmalloc(sizeof (struct refinfo));161 ref = xmalloc(sizeof (struct refinfo));
162 ref->refname = xstrdup(refname);162 ref->refname = xstrdup(refname);
163 ref->object = parse_object(oid->hash);163 ref->object = parse_object(oid);
164 switch (ref->object->type) {164 switch (ref->object->type) {
165 case OBJ_TAG:165 case OBJ_TAG:
166 ref->tag = cgit_parse_tag((struct tag *)ref->object);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 diff_setup_done(&opt);360 diff_setup_done(&opt);
361 361
362 if (old_oid && !is_null_oid(old_oid))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 else364 else
365 diff_root_tree_sha1(new_oid->hash, "", &opt);365 diff_root_tree_oid(new_oid, "", &opt);
366 diffcore_std(&opt);366 diffcore_std(&opt);
367 diff_flush(&opt);367 diff_flush(&opt);
368 368
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
56 goto done;56 goto done;
57 if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)57 if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
58 goto done;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
61done:61done:
62 free(path_items.match);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 return -1;89 return -1;
90 type = sha1_object_info(oid.hash, &size);90 type = sha1_object_info(oid.hash, &size);
91 if (type == OBJ_COMMIT) {91 if (type == OBJ_COMMIT) {
92 commit = lookup_commit_reference(oid.hash);92 commit = lookup_commit_reference(&oid);
93 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);93 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
94 if (!walk_tree_ctx.found_path)94 if (!walk_tree_ctx.found_path)
95 return -1;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 type = sha1_object_info(oid.hash, &size);145 type = sha1_object_info(oid.hash, &size);
146 146
147 if ((!hex) && type == OBJ_COMMIT && path) {147 if ((!hex) && type == OBJ_COMMIT && path) {
148 commit = lookup_commit_reference(oid.hash);148 commit = lookup_commit_reference(&oid);
149 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);149 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
150 type = sha1_object_info(oid.hash, &size);150 type = sha1_object_info(oid.hash, &size);
151 }151 }
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
17{17{
18 struct object *obj;18 struct object *obj;
19 19
20 if (!(obj = parse_object(oid->hash)))20 if (!(obj = parse_object(oid)))
21 return 0;21 return 0;
22 22
23 htmlf("%s\t%s\n", oid_to_hex(oid), refname);23 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
31 "Bad object id: %s", hex);31 "Bad object id: %s", hex);
32 return;32 return;
33 }33 }
34 commit = lookup_commit_reference(oid.hash);34 commit = lookup_commit_reference(&oid);
35 if (!commit) {35 if (!commit) {
36 cgit_print_error_page(404, "Not found",36 cgit_print_error_page(404, "Not found",
37 "Bad commit reference: %s", hex);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 info = cgit_parse_commit(commit);40 info = cgit_parse_commit(commit);
41 41
42 format_display_notes(oid.hash, &notes, PAGE_ENCODING, 0);42 format_display_notes(&oid, &notes, PAGE_ENCODING, 0);
43 43
44 load_ref_decorations(DECORATE_FULL_REFS);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 free(tmp);87 free(tmp);
88 html("</td></tr>\n");88 html("</td></tr>\n");
89 for (p = commit->parents; p; p = p->next) {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 if (!parent) {91 if (!parent) {
92 html("<tr><td colspan='3'>");92 html("<tr><td colspan='3'>");
93 cgit_print_error("Error reading parent commit");93 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
385 const char *prefix, int show_ctrls, int raw)385 const char *prefix, int show_ctrls, int raw)
386{386{
387 struct commit *commit, *commit2;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 diff_type difftype;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 "Bad object name: %s", new_rev);407 "Bad object name: %s", new_rev);
408 return;408 return;
409 }409 }
410 commit = lookup_commit_reference(new_rev_oid->hash);410 commit = lookup_commit_reference(new_rev_oid);
411 if (!commit || parse_commit(commit)) {411 if (!commit || parse_commit(commit)) {
412 cgit_print_error_page(404, "Not found",412 cgit_print_error_page(404, "Not found",
413 "Bad commit: %s", oid_to_hex(new_rev_oid));413 "Bad commit: %s", oid_to_hex(new_rev_oid));
414 return;414 return;
415 }415 }
416 new_tree_sha1 = commit->tree->object.oid.hash;416 new_tree_oid = &commit->tree->object.oid;
417 417
418 if (old_rev) {418 if (old_rev) {
419 if (get_oid(old_rev, old_rev_oid)) {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 if (!is_null_oid(old_rev_oid)) {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 if (!commit2 || parse_commit(commit2)) {432 if (!commit2 || parse_commit(commit2)) {
433 cgit_print_error_page(404, "Not found",433 cgit_print_error_page(404, "Not found",
434 "Bad commit: %s", oid_to_hex(old_rev_oid));434 "Bad commit: %s", oid_to_hex(old_rev_oid));
435 return;435 return;
436 }436 }
437 old_tree_sha1 = commit2->tree->object.oid.hash;437 old_tree_oid = &commit2->tree->object.oid;
438 } else {438 } else {
439 old_tree_sha1 = NULL;439 old_tree_oid = NULL;
440 }440 }
441 441
442 if (raw) {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 ctx.page.mimetype = "text/plain";450 ctx.page.mimetype = "text/plain";
451 cgit_print_http_headers();451 cgit_print_http_headers();
452 if (old_tree_sha1) {452 if (old_tree_oid) {
453 diff_tree_sha1(old_tree_sha1, new_tree_sha1, "",453 diff_tree_oid(old_tree_oid, new_tree_oid, "",
454 &diffopt);454 &diffopt);
455 } else {455 } else {
456 diff_root_tree_sha1(new_tree_sha1, "", &diffopt);456 diff_root_tree_oid(new_tree_oid, "", &diffopt);
457 }457 }
458 diffcore_std(&diffopt);458 diffcore_std(&diffopt);
459 diff_flush(&diffopt);459 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
150 rem_lines = 0;150 rem_lines = 0;
151 151
152 DIFF_OPT_SET(&revs->diffopt, RECURSIVE);152 DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
153 diff_tree_sha1(parent->tree->object.oid.hash,153 diff_tree_oid(&parent->tree->object.oid,
154 commit->tree->object.oid.hash,154 &commit->tree->object.oid,
155 "", &revs->diffopt);155 "", &revs->diffopt);
156 diffcore_std(&revs->diffopt);156 diffcore_std(&revs->diffopt);
157 157
158 found = !diff_queue_is_empty();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 strbuf_addstr(&msgbuf, info->msg);273 strbuf_addstr(&msgbuf, info->msg);
274 strbuf_addch(&msgbuf, '\n');274 strbuf_addch(&msgbuf, '\n');
275 }275 }
276 format_display_notes(commit->object.oid.hash,276 format_display_notes(&commit->object.oid,
277 &msgbuf, PAGE_ENCODING, 0);277 &msgbuf, PAGE_ENCODING, 0);
278 strbuf_addch(&msgbuf, '\n');278 strbuf_addch(&msgbuf, '\n');
279 strbuf_ltrim(&msgbuf);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 setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);436 setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);
437 load_ref_decorations(DECORATE_FULL_REFS);437 load_ref_decorations(DECORATE_FULL_REFS);
438 rev.show_decorations = 1;438 rev.show_decorations = 1;
439 rev.grep_filter.regflags |= REG_ICASE;439 rev.grep_filter.ignore_case = 1;
440 440
441 rev.diffopt.detect_rename = 1;441 rev.diffopt.detect_rename = 1;
442 rev.diffopt.rename_limit = ctx.cfg.renamelimit;442 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
33 "Bad object id: %s", new_rev);33 "Bad object id: %s", new_rev);
34 return;34 return;
35 }35 }
36 commit = lookup_commit_reference(new_rev_oid.hash);36 commit = lookup_commit_reference(&new_rev_oid);
37 if (!commit) {37 if (!commit) {
38 cgit_print_error_page(404, "Not found",38 cgit_print_error_page(404, "Not found",
39 "Bad commit reference: %s", new_rev);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 "Bad object id: %s", old_rev);46 "Bad object id: %s", old_rev);
47 return;47 return;
48 }48 }
49 if (!lookup_commit_reference(old_rev_oid.hash)) {49 if (!lookup_commit_reference(&old_rev_oid)) {
50 cgit_print_error_page(404, "Not found",50 cgit_print_error_page(404, "Not found",
51 "Bad commit reference: %s", old_rev);51 "Bad commit reference: %s", old_rev);
52 return;52 return;
ui-plain.c+1−1
@@ -185,7 +185,7 @@ void cgit_print_plain(void) · 184 unmodified lines
185 cgit_print_error_page(404, "Not found", "Not found");185 cgit_print_error_page(404, "Not found", "Not found");
186 return;186 return;
187 }187 }
188 commit = lookup_commit_reference(oid.hash);188 commit = lookup_commit_reference(&oid);
189 if (!commit || parse_commit(commit)) {189 if (!commit || parse_commit(commit)) {
190 cgit_print_error_page(404, "Not found", "Not found");190 cgit_print_error_page(404, "Not found", "Not found");
191 return;191 return;
ui-snapshot.c+1−1
@@ -116,7 +116,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format, · 115 unmodified lines
116 "Bad object id: %s", hex);116 "Bad object id: %s", hex);
117 return 1;117 return 1;
118 }118 }
119 if (!lookup_commit_reference(oid.hash)) {119 if (!lookup_commit_reference(&oid)) {
120 cgit_print_error_page(400, "Bad request",120 cgit_print_error_page(400, "Bad request",
121 "Not a commit reference: %s", hex);121 "Not a commit reference: %s", hex);
122 return 1;122 return 1;
ui-tag.c+2−2
@@ -54,7 +54,7 @@ void cgit_print_tag(char *revname) · 53 unmodified lines
54 "Bad tag reference: %s", revname);54 "Bad tag reference: %s", revname);
55 goto cleanup;55 goto cleanup;
56 }56 }
57 obj = parse_object(oid.hash);57 obj = parse_object(&oid);
58 if (!obj) {58 if (!obj) {
59 cgit_print_error_page(500, "Internal server error",59 cgit_print_error_page(500, "Internal server error",
60 "Bad object id: %s", oid_to_hex(&oid));60 "Bad object id: %s", oid_to_hex(&oid));
@@ -64,7 +64,7 @@ void cgit_print_tag(char *revname) · 3 unmodified lines
64 struct tag *tag;64 struct tag *tag;
65 struct taginfo *info;65 struct taginfo *info;
66 66
67 tag = lookup_tag(oid.hash);67 tag = lookup_tag(&oid);
68 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {68 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
69 cgit_print_error_page(500, "Internal server error",69 cgit_print_error_page(500, "Internal server error",
70 "Bad tag object: %s", revname);70 "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
157 157
158struct single_tree_ctx {158struct single_tree_ctx {
159 struct strbuf *path;159 struct strbuf *path;
160 unsigned char sha1[GIT_SHA1_RAWSZ];160 struct object_id oid;
161 char *name;161 char *name;
162 size_t count;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 ctx->name = xstrdup(pathname);179 ctx->name = xstrdup(pathname);
180 hashcpy(ctx->sha1, sha1);180 hashcpy(ctx->oid.hash, sha1);
181 strbuf_addf(ctx->path, "/%s", pathname);181 strbuf_addf(ctx->path, "/%s", pathname);
182 return 0;182 return 0;
183}183}
@@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name, · 11 unmodified lines
195 .nr = 0195 .nr = 0
196 };196 };
197 197
198 hashcpy(tree_ctx.sha1, sha1);198 hashcpy(tree_ctx.oid.hash, sha1);
199 199
200 while (tree_ctx.count == 1) {200 while (tree_ctx.count == 1) {
201 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,201 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
202 fullpath->buf);202 fullpath->buf);
203 203
204 tree = lookup_tree(tree_ctx.sha1);204 tree = lookup_tree(&tree_ctx.oid);
205 if (!tree)205 if (!tree)
206 return;206 return;
207 207
@@ -300,17 +300,17 @@ static void ls_tail(void) · 92 unmodified lines
300 cgit_print_layout_end();300 cgit_print_layout_end();
301}301}
302 302
303static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx)303static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx)
304{304{
305 struct tree *tree;305 struct tree *tree;
306 struct pathspec paths = {306 struct pathspec paths = {
307 .nr = 0307 .nr = 0
308 };308 };
309 309
310 tree = parse_tree_indirect(sha1);310 tree = parse_tree_indirect(oid);
311 if (!tree) {311 if (!tree) {
312 cgit_print_error_page(404, "Not found",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 return;314 return;
315 }315 }
316 316
@@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path) · 63 unmodified lines
380 "Invalid revision name: %s", rev);380 "Invalid revision name: %s", rev);
381 return;381 return;
382 }382 }
383 commit = lookup_commit_reference(oid.hash);383 commit = lookup_commit_reference(&oid);
384 if (!commit || parse_commit(commit)) {384 if (!commit || parse_commit(commit)) {
385 cgit_print_error_page(404, "Not found",385 cgit_print_error_page(404, "Not found",
386 "Invalid commit reference: %s", rev);386 "Invalid commit reference: %s", rev);
@@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path) · 3 unmodified lines
390 walk_tree_ctx.curr_rev = xstrdup(rev);390 walk_tree_ctx.curr_rev = xstrdup(rev);
391 391
392 if (path == NULL) {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 goto cleanup;394 goto cleanup;
395 }395 }
396 396