MFH: r474007 r474079 r474827 r477003

- Update included git to 2.17.1

PR:		227536

devel/cgit: Fix patch

PR:		227536

devel/cgit: update 1.1 -> 1.2

- among other things, update to git 2.18

PR:		229841
Submitted by:	Yasuhiro KIMURA <yasu@utahime.org>
Approved by:	Marko Turk <mt@markoturk.info> (maintainer)
Relnotes:	https://lists.zx2c4.com/pipermail/cgit/2018-July/004160.html

Update to upstream release 1.2.1 (Fixes CVE-2018-14912)

PR:		230361
Submitted by:	yasu@utahime.org
Approved by:	mt@markoturk.info (maintainer)
Security:	CVE-2018-14912

Approved by:	ports-secteam (riggs)
This commit is contained in:
Thomas Zander 2018-08-12 17:50:11 +00:00
parent acd8a89567
commit d6e51f51cb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q3/; revision=477033
8 changed files with 8 additions and 766 deletions

View File

@ -1,8 +1,7 @@
# $FreeBSD$
PORTNAME= cgit
PORTVERSION= 1.1
PORTREVISION= 18
PORTVERSION= 1.2.1
CATEGORIES= devel www
MASTER_SITES= http://git.zx2c4.com/cgit/snapshot/:cgit \
https://www.kernel.org/pub/software/scm/git/:git
@ -17,7 +16,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING
TEST_DEPENDS= msgfmt:devel/gettext-tools
GIT_VERSION= 2.16.3
GIT_VERSION= 2.18.0
USES= cpe gmake iconv perl5 python:env shebangfix ssl tar:xz
CPE_VENDOR= lars_hjemli
USE_PERL5= test

View File

@ -1,5 +1,5 @@
TIMESTAMP = 1521825342
SHA256 (cgit-1.1.tar.xz) = 0889af29be15fc981481caa09579f982b9740fe9fd2860ab87dff286f4635890
SIZE (cgit-1.1.tar.xz) = 86268
SHA256 (git-2.16.3.tar.xz) = d65d99e9e5b081c1f14ea018973806e942a2eb7d0da2ebc01bd2525adee62d48
SIZE (git-2.16.3.tar.xz) = 4966248
TIMESTAMP = 1533411742
SHA256 (cgit-1.2.1.tar.xz) = 3c547c146340fb16d4134326e7524bfb28ffa681284f1e3914bde1c27a9182bf
SIZE (cgit-1.2.1.tar.xz) = 89648
SHA256 (git-2.18.0.tar.xz) = 8b40be383a603147ae29337136c00d1c634bdfdc169a30924a024596a7e30e92
SIZE (git-2.18.0.tar.xz) = 5102264

View File

@ -1,147 +0,0 @@
From 5c80837ea913179a6a983076c4adbab42e6a31dc Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Wed, 1 Mar 2017 11:37:59 +0100
Subject: git: update to v2.12.0
Update to git version v2.12.0: With commit 8aee769f (pathspec: copy and free
owned memory) member 'match' of 'struct pathspec_item' is no longer
'const char*' but just 'char*'.
---
cgit.h | 4 ++--
shared.c | 4 ++--
ui-blob.c | 2 +-
ui-blob.h | 2 +-
ui-commit.c | 2 +-
ui-commit.h | 2 +-
ui-diff.c | 4 ++--
ui-diff.h | 2 +-
10 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/cgit.h b/cgit.h
index fbc6c6a..3eb04de 100644
--- cgit.h
+++ cgit.h
@@ -355,10 +355,10 @@ extern int cgit_diff_files(const struct object_id *old_oid,
extern void cgit_diff_tree(const struct object_id *old_oid,
const struct object_id *new_oid,
- filepair_fn fn, const char *prefix, int ignorews);
+ filepair_fn fn, char *prefix, int ignorews);
extern void cgit_diff_commit(struct commit *commit, filepair_fn fn,
- const char *prefix);
+ char *prefix);
__attribute__((format (printf,1,2)))
extern char *fmt(const char *format,...);
diff --git a/shared.c b/shared.c
index c63f1e3..4602123 100644
--- shared.c
+++ shared.c
@@ -336,7 +336,7 @@ int cgit_diff_files(const struct object_id *old_oid,
void cgit_diff_tree(const struct object_id *old_oid,
const struct object_id *new_oid,
- filepair_fn fn, const char *prefix, int ignorews)
+ filepair_fn fn, char *prefix, int ignorews)
{
struct diff_options opt;
struct pathspec_item item;
@@ -367,7 +367,7 @@ void cgit_diff_tree(const struct object_id *old_oid,
diff_flush(&opt);
}
-void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)
+void cgit_diff_commit(struct commit *commit, filepair_fn fn, char *prefix)
{
const struct object_id *old_oid = NULL;
diff --git a/ui-blob.c b/ui-blob.c
index 5f30de7..c759520 100644
--- ui-blob.c
+++ ui-blob.c
@@ -33,7 +33,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base,
return 0;
}
-int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
+int cgit_ref_path_exists(char *path, const char *ref, int file_only)
{
struct object_id oid;
unsigned long size;
diff --git a/ui-blob.h b/ui-blob.h
index 16847b2..d4be56a 100644
--- ui-blob.h
+++ ui-blob.h
@@ -1,7 +1,7 @@
#ifndef UI_BLOB_H
#define UI_BLOB_H
-extern int cgit_ref_path_exists(const char *path, const char *ref, int file_only);
+extern int cgit_ref_path_exists(char *path, const char *ref, int file_only);
extern int cgit_print_file(char *path, const char *head, int file_only);
extern void cgit_print_blob(const char *hex, char *path, const char *head, int file_only);
diff --git a/ui-commit.c b/ui-commit.c
index db69d54..47b9025 100644
--- ui-commit.c
+++ ui-commit.c
@@ -13,7 +13,7 @@
#include "ui-diff.h"
#include "ui-log.h"
-void cgit_print_commit(char *hex, const char *prefix)
+void cgit_print_commit(char *hex, char *prefix)
{
struct commit *commit, *parent;
struct commitinfo *info, *parent_info;
diff --git a/ui-commit.h b/ui-commit.h
index 8198b4b..3d19eeb 100644
--- ui-commit.h
+++ ui-commit.h
@@ -1,6 +1,6 @@
#ifndef UI_COMMIT_H
#define UI_COMMIT_H
-extern void cgit_print_commit(char *hex, const char *prefix);
+extern void cgit_print_commit(char *hex, char *prefix);
#endif /* UI_COMMIT_H */
diff --git a/ui-diff.c b/ui-diff.c
index 173d351..e8e9897 100644
--- ui-diff.c
+++ ui-diff.c
@@ -189,7 +189,7 @@ static void inspect_filepair(struct diff_filepair *pair)
static void cgit_print_diffstat(const struct object_id *old_oid,
const struct object_id *new_oid,
- const char *prefix)
+ char *prefix)
{
int i;
@@ -382,7 +382,7 @@ void cgit_print_diff_ctrls(void)
}
void cgit_print_diff(const char *new_rev, const char *old_rev,
- const char *prefix, int show_ctrls, int raw)
+ char *prefix, int show_ctrls, int raw)
{
struct commit *commit, *commit2;
const unsigned char *old_tree_sha1, *new_tree_sha1;
diff --git a/ui-diff.h b/ui-diff.h
index 39264a1..4d5a83c 100644
--- ui-diff.h
+++ ui-diff.h
@@ -4,7 +4,7 @@
extern void cgit_print_diff_ctrls(void);
extern void cgit_print_diff(const char *new_hex, const char *old_hex,
- const char *prefix, int show_ctrls, int raw);
+ char *prefix, int show_ctrls, int raw);
extern struct diff_filespec *cgit_get_current_old_file(void);
extern struct diff_filespec *cgit_get_current_new_file(void);
--
cgit v1.1-7-g6221

View File

@ -1,72 +0,0 @@
From af3025cf50642452a2000327bb8e845fd2191423 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Tue, 6 Jun 2017 17:16:32 +0200
Subject: git: update to v2.13.1
Update to git version v2.13.1: With commit 8aee769f (pathspec: copy and free
owned memory) the definition of struct pathspec_item has changed with the
expectation that pathspecs will be managed dynamically. We work around this
a bit by setting up a static structure, but let's allocate the match string
to avoid needing to cast away const.
Updated a patch from John Keeping <john@keeping.me.uk> for git v2.12.1.
---
git | 2 +-
shared.c | 4 +++-
ui-blob.c | 9 ++++++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/shared.c b/shared.c
index c63f1e3..13a65a9 100644
--- shared.c
+++ shared.c
@@ -352,7 +352,7 @@ void cgit_diff_tree(const struct object_id *old_oid,
opt.format_callback = cgit_diff_tree_cb;
opt.format_callback_data = fn;
if (prefix) {
- item.match = prefix;
+ item.match = xstrdup(prefix);
item.len = strlen(prefix);
opt.pathspec.nr = 1;
opt.pathspec.items = &item;
@@ -365,6 +365,8 @@ void cgit_diff_tree(const struct object_id *old_oid,
diff_root_tree_sha1(new_oid->hash, "", &opt);
diffcore_std(&opt);
diff_flush(&opt);
+
+ free(item.match);
}
void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)
diff --git a/ui-blob.c b/ui-blob.c
index 5f30de7..793817f 100644
--- ui-blob.c
+++ ui-blob.c
@@ -38,7 +38,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
struct object_id oid;
unsigned long size;
struct pathspec_item path_items = {
- .match = path,
+ .match = xstrdup(path),
.len = strlen(path)
};
struct pathspec paths = {
@@ -53,10 +53,13 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
};
if (get_oid(ref, &oid))
- return 0;
+ goto done;
if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
- return 0;
+ goto done;
read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
+
+done:
+ free(path_items.match);
return walk_tree_ctx.found_path;
}
--
cgit v1.1-9-ge9c1d

View File

@ -1,413 +0,0 @@
From 86a6d358f7a6c2432fde86b9e3c5011a656f20e4 Mon Sep 17 00:00:00 2001
From: Jeff Smith <whydoubt@gmail.com>
Date: Wed, 9 Aug 2017 19:02:56 -0500
Subject: 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.
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
---
Makefile | 2 +-
git | 2 +-
scan-tree.c | 5 +++--
shared.c | 6 +++---
ui-blob.c | 6 +++---
ui-clone.c | 2 +-
ui-commit.c | 6 +++---
ui-diff.c | 18 +++++++++---------
ui-log.c | 10 +++++-----
ui-patch.c | 4 ++--
ui-plain.c | 2 +-
ui-snapshot.c | 2 +-
ui-tag.c | 4 ++--
ui-tree.c | 18 +++++++++---------
14 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/scan-tree.c b/scan-tree.c
index 08f3f1d..6a2f65a 100644
--- scan-tree.c
+++ scan-tree.c
@@ -10,6 +10,7 @@
#include "scan-tree.h"
#include "configfile.h"
#include "html.h"
+#include <config.h>
/* return 1 if path contains a objects/ directory and a HEAD file */
static int is_git_dir(const char *path)
@@ -48,7 +49,7 @@ out:
static struct cgit_repo *repo;
static repo_config_fn config_fn;
-static void repo_config(const char *name, const char *value)
+static void scan_tree_repo_config(const char *name, const char *value)
{
config_fn(repo, name, value);
}
@@ -178,7 +179,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
strbuf_addstr(path, "cgitrc");
if (!stat(path->buf, &st))
- parse_configfile(path->buf, &repo_config);
+ parse_configfile(path->buf, &scan_tree_repo_config);
strbuf_release(&rel);
}
diff --git a/shared.c b/shared.c
index 13a65a9..df3f611 100644
--- shared.c
+++ shared.c
@@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_
ref = xmalloc(sizeof (struct refinfo));
ref->refname = xstrdup(refname);
- ref->object = parse_object(oid->hash);
+ ref->object = parse_object(oid);
switch (ref->object->type) {
case OBJ_TAG:
ref->tag = cgit_parse_tag((struct tag *)ref->object);
@@ -360,9 +360,9 @@ void cgit_diff_tree(const struct object_id *old_oid,
diff_setup_done(&opt);
if (old_oid && !is_null_oid(old_oid))
- diff_tree_sha1(old_oid->hash, new_oid->hash, "", &opt);
+ diff_tree_oid(old_oid, new_oid, "", &opt);
else
- diff_root_tree_sha1(new_oid->hash, "", &opt);
+ diff_root_tree_oid(new_oid, "", &opt);
diffcore_std(&opt);
diff_flush(&opt);
diff --git a/ui-blob.c b/ui-blob.c
index 793817f..761e886 100644
--- ui-blob.c
+++ ui-blob.c
@@ -56,7 +56,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
goto done;
if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
goto done;
- read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
+ read_tree_recursive(lookup_commit_reference(&oid)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
done:
free(path_items.match);
@@ -89,7 +89,7 @@ int cgit_print_file(char *path, const char *head, int file_only)
return -1;
type = sha1_object_info(oid.hash, &size);
if (type == OBJ_COMMIT) {
- commit = lookup_commit_reference(oid.hash);
+ commit = lookup_commit_reference(&oid);
read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
if (!walk_tree_ctx.found_path)
return -1;
@@ -145,7 +145,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
type = sha1_object_info(oid.hash, &size);
if ((!hex) && type == OBJ_COMMIT && path) {
- commit = lookup_commit_reference(oid.hash);
+ commit = lookup_commit_reference(&oid);
read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
type = sha1_object_info(oid.hash, &size);
}
diff --git a/ui-clone.c b/ui-clone.c
index 5f6606a..0d11672 100644
--- ui-clone.c
+++ ui-clone.c
@@ -17,7 +17,7 @@ static int print_ref_info(const char *refname, const struct object_id *oid,
{
struct object *obj;
- if (!(obj = parse_object(oid->hash)))
+ if (!(obj = parse_object(oid)))
return 0;
htmlf("%s\t%s\n", oid_to_hex(oid), refname);
diff --git a/ui-commit.c b/ui-commit.c
index db69d54..586fea0 100644
--- ui-commit.c
+++ ui-commit.c
@@ -31,7 +31,7 @@ void cgit_print_commit(char *hex, const char *prefix)
"Bad object id: %s", hex);
return;
}
- commit = lookup_commit_reference(oid.hash);
+ commit = lookup_commit_reference(&oid);
if (!commit) {
cgit_print_error_page(404, "Not found",
"Bad commit reference: %s", hex);
@@ -39,7 +39,7 @@ void cgit_print_commit(char *hex, const char *prefix)
}
info = cgit_parse_commit(commit);
- format_display_notes(oid.hash, &notes, PAGE_ENCODING, 0);
+ format_display_notes(&oid, &notes, PAGE_ENCODING, 0);
load_ref_decorations(DECORATE_FULL_REFS);
@@ -87,7 +87,7 @@ void cgit_print_commit(char *hex, const char *prefix)
free(tmp);
html("</td></tr>\n");
for (p = commit->parents; p; p = p->next) {
- parent = lookup_commit_reference(p->item->object.oid.hash);
+ parent = lookup_commit_reference(&p->item->object.oid);
if (!parent) {
html("<tr><td colspan='3'>");
cgit_print_error("Error reading parent commit");
diff --git a/ui-diff.c b/ui-diff.c
index 173d351..c7fb49b 100644
--- ui-diff.c
+++ ui-diff.c
@@ -385,7 +385,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
const char *prefix, int show_ctrls, int raw)
{
struct commit *commit, *commit2;
- const unsigned char *old_tree_sha1, *new_tree_sha1;
+ const struct object_id *old_tree_oid, *new_tree_oid;
diff_type difftype;
/*
@@ -407,13 +407,13 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
"Bad object name: %s", new_rev);
return;
}
- commit = lookup_commit_reference(new_rev_oid->hash);
+ commit = lookup_commit_reference(new_rev_oid);
if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found",
"Bad commit: %s", oid_to_hex(new_rev_oid));
return;
}
- new_tree_sha1 = commit->tree->object.oid.hash;
+ new_tree_oid = &commit->tree->object.oid;
if (old_rev) {
if (get_oid(old_rev, old_rev_oid)) {
@@ -428,15 +428,15 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
}
if (!is_null_oid(old_rev_oid)) {
- commit2 = lookup_commit_reference(old_rev_oid->hash);
+ commit2 = lookup_commit_reference(old_rev_oid);
if (!commit2 || parse_commit(commit2)) {
cgit_print_error_page(404, "Not found",
"Bad commit: %s", oid_to_hex(old_rev_oid));
return;
}
- old_tree_sha1 = commit2->tree->object.oid.hash;
+ old_tree_oid = &commit2->tree->object.oid;
} else {
- old_tree_sha1 = NULL;
+ old_tree_oid = NULL;
}
if (raw) {
@@ -449,11 +449,11 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
ctx.page.mimetype = "text/plain";
cgit_print_http_headers();
- if (old_tree_sha1) {
- diff_tree_sha1(old_tree_sha1, new_tree_sha1, "",
+ if (old_tree_oid) {
+ diff_tree_oid(old_tree_oid, new_tree_oid, "",
&diffopt);
} else {
- diff_root_tree_sha1(new_tree_sha1, "", &diffopt);
+ diff_root_tree_oid(new_tree_oid, "", &diffopt);
}
diffcore_std(&diffopt);
diff_flush(&diffopt);
diff --git a/ui-log.c b/ui-log.c
index 3220fd9..2d2bb31 100644
--- ui-log.c
+++ ui-log.c
@@ -150,9 +150,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
rem_lines = 0;
DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
- diff_tree_sha1(parent->tree->object.oid.hash,
- commit->tree->object.oid.hash,
- "", &revs->diffopt);
+ diff_tree_oid(&parent->tree->object.oid,
+ &commit->tree->object.oid,
+ "", &revs->diffopt);
diffcore_std(&revs->diffopt);
found = !diff_queue_is_empty();
@@ -273,7 +273,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
strbuf_addstr(&msgbuf, info->msg);
strbuf_addch(&msgbuf, '\n');
}
- format_display_notes(commit->object.oid.hash,
+ format_display_notes(&commit->object.oid,
&msgbuf, PAGE_ENCODING, 0);
strbuf_addch(&msgbuf, '\n');
strbuf_ltrim(&msgbuf);
@@ -436,7 +436,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);
load_ref_decorations(DECORATE_FULL_REFS);
rev.show_decorations = 1;
- rev.grep_filter.regflags |= REG_ICASE;
+ rev.grep_filter.ignore_case = 1;
rev.diffopt.detect_rename = 1;
rev.diffopt.rename_limit = ctx.cfg.renamelimit;
diff --git a/ui-patch.c b/ui-patch.c
index 047e2f9..69aa4a8 100644
--- ui-patch.c
+++ ui-patch.c
@@ -33,7 +33,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
"Bad object id: %s", new_rev);
return;
}
- commit = lookup_commit_reference(new_rev_oid.hash);
+ commit = lookup_commit_reference(&new_rev_oid);
if (!commit) {
cgit_print_error_page(404, "Not found",
"Bad commit reference: %s", new_rev);
@@ -46,7 +46,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
"Bad object id: %s", old_rev);
return;
}
- if (!lookup_commit_reference(old_rev_oid.hash)) {
+ if (!lookup_commit_reference(&old_rev_oid)) {
cgit_print_error_page(404, "Not found",
"Bad commit reference: %s", old_rev);
return;
diff --git a/ui-plain.c b/ui-plain.c
index 8d541e3..e45d553 100644
--- ui-plain.c
+++ ui-plain.c
@@ -185,7 +185,7 @@ void cgit_print_plain(void)
cgit_print_error_page(404, "Not found", "Not found");
return;
}
- commit = lookup_commit_reference(oid.hash);
+ commit = lookup_commit_reference(&oid);
if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found", "Not found");
return;
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 9b8cddd..b2d95f7 100644
--- ui-snapshot.c
+++ ui-snapshot.c
@@ -116,7 +116,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
"Bad object id: %s", hex);
return 1;
}
- if (!lookup_commit_reference(oid.hash)) {
+ if (!lookup_commit_reference(&oid)) {
cgit_print_error_page(400, "Bad request",
"Not a commit reference: %s", hex);
return 1;
diff --git a/ui-tag.c b/ui-tag.c
index afd7d61..909cde0 100644
--- ui-tag.c
+++ ui-tag.c
@@ -54,7 +54,7 @@ void cgit_print_tag(char *revname)
"Bad tag reference: %s", revname);
goto cleanup;
}
- obj = parse_object(oid.hash);
+ obj = parse_object(&oid);
if (!obj) {
cgit_print_error_page(500, "Internal server error",
"Bad object id: %s", oid_to_hex(&oid));
@@ -64,7 +64,7 @@ void cgit_print_tag(char *revname)
struct tag *tag;
struct taginfo *info;
- tag = lookup_tag(oid.hash);
+ tag = lookup_tag(&oid);
if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
cgit_print_error_page(500, "Internal server error",
"Bad tag object: %s", revname);
diff --git a/ui-tree.c b/ui-tree.c
index b310242..ca24a03 100644
--- ui-tree.c
+++ ui-tree.c
@@ -157,7 +157,7 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
struct single_tree_ctx {
struct strbuf *path;
- unsigned char sha1[GIT_SHA1_RAWSZ];
+ struct object_id oid;
char *name;
size_t count;
};
@@ -177,7 +177,7 @@ static int single_tree_cb(const unsigned char *sha1, struct strbuf *base,
}
ctx->name = xstrdup(pathname);
- hashcpy(ctx->sha1, sha1);
+ hashcpy(ctx->oid.hash, sha1);
strbuf_addf(ctx->path, "/%s", pathname);
return 0;
}
@@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name,
.nr = 0
};
- hashcpy(tree_ctx.sha1, sha1);
+ hashcpy(tree_ctx.oid.hash, sha1);
while (tree_ctx.count == 1) {
cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
fullpath->buf);
- tree = lookup_tree(tree_ctx.sha1);
+ tree = lookup_tree(&tree_ctx.oid);
if (!tree)
return;
@@ -300,17 +300,17 @@ static void ls_tail(void)
cgit_print_layout_end();
}
-static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx)
+static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx)
{
struct tree *tree;
struct pathspec paths = {
.nr = 0
};
- tree = parse_tree_indirect(sha1);
+ tree = parse_tree_indirect(oid);
if (!tree) {
cgit_print_error_page(404, "Not found",
- "Not a tree object: %s", sha1_to_hex(sha1));
+ "Not a tree object: %s", sha1_to_hex(oid->hash));
return;
}
@@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path)
"Invalid revision name: %s", rev);
return;
}
- commit = lookup_commit_reference(oid.hash);
+ commit = lookup_commit_reference(&oid);
if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found",
"Invalid commit reference: %s", rev);
@@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path)
walk_tree_ctx.curr_rev = xstrdup(rev);
if (path == NULL) {
- ls_tree(commit->tree->object.oid.hash, NULL, &walk_tree_ctx);
+ ls_tree(&commit->tree->object.oid, NULL, &walk_tree_ctx);
goto cleanup;
}
--
cgit v1.1-9-ge9c1d

View File

@ -1,115 +0,0 @@
From 1dd53e3a2ffec730ec27ebe15b3d63e0b417a544 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Thu, 18 Jan 2018 09:19:31 +0100
Subject: git: update to v2.16.0
Update to git version v2.16.0:
* refs: convert resolve_ref_unsafe to struct object_id
(49e61479be913f67e66bb3fdf8de9475c41b58bd)
* diff: remove DIFF_OPT_SET macro
(23dcf77f48feb49c54bad09210f093a799816334)
* log: add option to choose which refs to decorate
(65516f586b69307f977cd67cc45513a296cabc25)
* diff: convert flags to be stored in bitfields
(02f2f56bc377c287c411947d0e1482aac888f8db)
Signed-off-by: Christian Hesse <mail@eworm.de>
---
Makefile | 2 +-
cgit.c | 2 +-
git | 2 +-
shared.c | 2 +-
ui-blame.c | 2 +-
ui-commit.c | 2 +-
ui-diff.c | 2 +-
ui-log.c | 7 +++----
8 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/cgit.c b/cgit.c
index 972a67e..a3702c2 100644
--- cgit.c
+++ cgit.c
@@ -478,7 +478,7 @@ static char *guess_defbranch(void)
const char *ref, *refname;
struct object_id oid;
- ref = resolve_ref_unsafe("HEAD", 0, oid.hash, NULL);
+ ref = resolve_ref_unsafe("HEAD", 0, &oid, NULL);
if (!ref || !skip_prefix(ref, "refs/heads/", &refname))
return "master";
return xstrdup(refname);
diff --git a/shared.c b/shared.c
index df3f611..21ac8f4 100644
--- shared.c
+++ shared.c
@@ -346,7 +346,7 @@ void cgit_diff_tree(const struct object_id *old_oid,
opt.output_format = DIFF_FORMAT_CALLBACK;
opt.detect_rename = 1;
opt.rename_limit = ctx.cfg.renamelimit;
- DIFF_OPT_SET(&opt, RECURSIVE);
+ opt.flags.recursive = 1;
if (ignorews)
DIFF_XDL_SET(&opt, IGNORE_WHITESPACE);
opt.format_callback = cgit_diff_tree_cb;
diff --git a/ui-commit.c b/ui-commit.c
index 586fea0..abf58f6 100644
--- ui-commit.c
+++ ui-commit.c
@@ -41,7 +41,7 @@ void cgit_print_commit(char *hex, const char *prefix)
format_display_notes(&oid, &notes, PAGE_ENCODING, 0);
- load_ref_decorations(DECORATE_FULL_REFS);
+ load_ref_decorations(NULL, DECORATE_FULL_REFS);
cgit_print_layout_start();
cgit_print_diff_ctrls();
diff --git a/ui-diff.c b/ui-diff.c
index c7fb49b..a10ce8a 100644
--- ui-diff.c
+++ ui-diff.c
@@ -444,7 +444,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
diff_setup(&diffopt);
diffopt.output_format = DIFF_FORMAT_PATCH;
- DIFF_OPT_SET(&diffopt, RECURSIVE);
+ diffopt.flags.recursive = 1;
diff_setup_done(&diffopt);
ctx.page.mimetype = "text/plain";
diff --git a/ui-log.c b/ui-log.c
index 2d2bb31..8e36fba 100644
--- ui-log.c
+++ ui-log.c
@@ -119,8 +119,7 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
struct commit_list *parents = commit->parents;
struct commit *parent;
int found = 0, saved_fmt;
- unsigned saved_flags = revs->diffopt.flags;
-
+ struct diff_flags saved_flags = revs->diffopt.flags;
/* Always show if we're not in "follow" mode with a single file. */
if (!ctx.qry.follow)
@@ -149,7 +148,7 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
add_lines = 0;
rem_lines = 0;
- DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
+ revs->diffopt.flags.recursive = 1;
diff_tree_oid(&parent->tree->object.oid,
&commit->tree->object.oid,
"", &revs->diffopt);
@@ -434,7 +433,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
rev.ignore_missing = 1;
rev.simplify_history = 1;
setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);
- load_ref_decorations(DECORATE_FULL_REFS);
+ load_ref_decorations(NULL, DECORATE_FULL_REFS);
rev.show_decorations = 1;
rev.grep_filter.ignore_case = 1;
--
cgit v1.1-35-ge94e

View File

@ -1,11 +0,0 @@
--- ui-snapshot.c.orig 2016-12-01 13:52:53 UTC
+++ ui-snapshot.c
@@ -37,7 +37,7 @@ static int write_archive_type(const char
/* argv_array guarantees a trailing NULL entry. */
memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1));
- result = write_archive(argv.argc, nargv, NULL, 1, NULL, 0);
+ result = write_archive(argv.argc, nargv, NULL, NULL, 0);
argv_array_clear(&argv);
free(nargv);
return result;

View File

@ -3,6 +3,7 @@ lib/cgit/filters/commit-links.sh
lib/cgit/filters/email-gravatar.lua
lib/cgit/filters/email-gravatar.py
lib/cgit/filters/email-libravatar.lua
lib/cgit/filters/file-authentication.lua
lib/cgit/filters/gentoo-ldap-authentication.lua
lib/cgit/filters/html-converters/man2html
lib/cgit/filters/html-converters/md2html