Hello community, here is the log from the commit of package cgit for openSUSE:Factory checked in at 2016-06-14 23:08:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cgit (Old) and /work/SRC/openSUSE:Factory/.cgit.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cgit" Changes: -------- --- /work/SRC/openSUSE:Factory/cgit/cgit.changes 2016-03-17 16:49:34.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.cgit.new/cgit.changes 2016-06-14 23:08:52.000000000 +0200 @@ -1,0 +2,27 @@ +Mon Jun 13 22:29:05 UTC 2016 - [email protected] + +- cgit 1.0: + * Add repo.homepage/gitweb.homepage setting and homepage tab. + * Considerable internal cleanups. + * Show reverse paths in title bar so that browser tab shows + filename. + * Add syntax highlighting to md2html. + * Allow redirects even when caching is turned on. + * Fix empty PATH_INFO on redirect. + * Better HTML5 compliance. + * Simplified decorations. + * Show repo's root directory in plain view. + * Date printing and timezone normalization. + * Unicode issues in syntax highlighting. + * Account for caches with empty key. + * Use size_t for all lengths. + * More gracefully deal with unparsable commits. +- with git 2.8.3 +- the following patches are now included upstream git 2.8.3: + 0012-http-push-stop-using-name_path.patch + 0013-show_object_with_name-simplify-by-using-path_name.patch + 0014-list-objects-convert-name_path-to-a-strbuf.patch + 0015-list-objects-drop-name_path-entirely.patch + 0016-list-objects-pass-full-pathname-to-callbacks.patch + +------------------------------------------------------------------- Old: ---- 0012-http-push-stop-using-name_path.patch 0013-show_object_with_name-simplify-by-using-path_name.patch 0014-list-objects-convert-name_path-to-a-strbuf.patch 0015-list-objects-drop-name_path-entirely.patch 0016-list-objects-pass-full-pathname-to-callbacks.patch cgit-0.12.tar.xz git-2.7.0.tar.sign git-2.7.0.tar.xz New: ---- cgit-1.0.tar.xz git-2.8.3.tar.sign git-2.8.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cgit.spec ++++++ --- /var/tmp/diff_new_pack.ssXtwf/_old 2016-06-14 23:08:53.000000000 +0200 +++ /var/tmp/diff_new_pack.ssXtwf/_new 2016-06-14 23:08:53.000000000 +0200 @@ -16,29 +16,23 @@ # -%define git_version 2.7.0 +%define git_version 2.8.3 Name: cgit -Version: 0.12 +Version: 1.0 Release: 0 Summary: A web frontend for git repositories Url: http://git.zx2c4.com/cgit/ License: GPL-2.0 Group: Development/Tools/Version Control -#Git-Clone: git://git.zx2c4.com/cgit -Source: http://git.zx2c4.com/cgit/snapshot/%name-%version.tar.xz +#Git-Clone: https://git.zx2c4.com/cgit +Source: https://git.zx2c4.com/cgit/snapshot/%name-%version.tar.xz Source2: https://www.kernel.org/pub/software/scm/git/git-%git_version.tar.xz Source3: https://www.kernel.org/pub/software/scm/git/git-%git_version.tar.sign Source4: %name.keyring Source9: cgitrc Patch0: cgit-optflags.diff -# PATCH-FIX-UPSTREAM fix remote code execution via buffer overflow (CVE-2016-2324, bsc#971328) -Patch12: 0012-http-push-stop-using-name_path.patch -Patch13: 0013-show_object_with_name-simplify-by-using-path_name.patch -Patch14: 0014-list-objects-convert-name_path-to-a-strbuf.patch -Patch15: 0015-list-objects-drop-name_path-entirely.patch -Patch16: 0016-list-objects-pass-full-pathname-to-callbacks.patch # Requirements for cgit BuildRequires: gnu-crypto BuildRequires: libopenssl-devel @@ -58,12 +52,6 @@ %patch0 -p1 rm -rf git ln -s git-%git_version git -cd git -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 %build make V=1 prefix="%_prefix" %{?_smp_mflags} ++++++ cgit-0.12.tar.xz -> cgit-1.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/Makefile new/cgit-1.0/Makefile --- old/cgit-0.12/Makefile 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/Makefile 2016-06-07 14:45:04.000000000 +0200 @@ -1,6 +1,6 @@ all:: -CGIT_VERSION = v0.12 +CGIT_VERSION = v1.0 CGIT_SCRIPT_NAME = cgit.cgi CGIT_SCRIPT_PATH = /var/www/htdocs/cgit CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) @@ -14,7 +14,7 @@ pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = <openssl/sha.h> -GIT_VER = 2.7.0 +GIT_VER = 2.8.3 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz INSTALL = install COPYTREE = cp -r diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/cache.c new/cgit-1.0/cache.c --- old/cgit-0.12/cache.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/cache.c 2016-06-07 14:45:04.000000000 +0200 @@ -24,7 +24,7 @@ struct cache_slot { const char *key; - int keylen; + size_t keylen; int ttl; cache_fill_fn fn; int cache_fd; @@ -44,7 +44,7 @@ static int open_slot(struct cache_slot *slot) { char *bufz; - int bufkeylen = -1; + ssize_t bufkeylen = -1; slot->cache_fd = open(slot->cache_name, O_RDONLY); if (slot->cache_fd == -1) @@ -61,8 +61,9 @@ if (bufz) bufkeylen = bufz - slot->buf; - slot->match = bufkeylen == slot->keylen && - !memcmp(slot->key, slot->buf, bufkeylen + 1); + if (slot->key) + slot->match = bufkeylen == slot->keylen && + !memcmp(slot->key, slot->buf, bufkeylen + 1); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/cgit.c new/cgit-1.0/cgit.c --- old/cgit-0.12/cgit.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/cgit.c 2016-06-07 14:45:04.000000000 +0200 @@ -41,6 +41,8 @@ repo->desc = xstrdup(value); else if (!strcmp(name, "owner")) repo->owner = xstrdup(value); + else if (!strcmp(name, "homepage")) + repo->homepage = xstrdup(value); else if (!strcmp(name, "defbranch")) repo->defbranch = xstrdup(value); else if (!strcmp(name, "snapshots")) @@ -793,6 +795,8 @@ fprintf(f, "repo.module-link=%s\n", repo->module_link); if (repo->section) fprintf(f, "repo.section=%s\n", repo->section); + if (repo->homepage) + fprintf(f, "repo.homepage=%s\n", repo->homepage); if (repo->clone_url) fprintf(f, "repo.clone-url=%s\n", repo->clone_url); fprintf(f, "repo.enable-commit-graph=%d\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/cgit.css new/cgit-1.0/cgit.css --- old/cgit-0.12/cgit.css 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/cgit.css 2016-06-07 14:45:04.000000000 +0200 @@ -18,7 +18,7 @@ } div#cgit table { - border-collapse: collapse; + border-collapse: collapse; } div#cgit table#header { @@ -85,6 +85,12 @@ background-color: #ccc; } +div#cgit table.tabs a[href^="http://"]:after, div#cgit table.tabs a[href^="https://"]:after { + content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgAhcJDQY+gm2TAAAAHWlUWHRDb21tZW50AAAAAABDcmVhdGVkIHdpdGggR0lNUGQuZQcAAABbSURBVAhbY2BABs4MU4CwhYHBh2Erww4wrGFQZHjI8B8IgUIscJWyDHcggltQhI4zGDCcRwhChPggHIggP1QoAVmQkSETrGoHsiAEsACtBYN0oDAMbgU6EBcAAL2eHUt4XUU4AAAAAElFTkSuQmCC); + opacity: 0.5; + margin: 0 0 0 5px; +} + div#cgit table.tabs td.form { text-align: right; } @@ -797,9 +803,9 @@ div#cgit table.ssdiff td.foot { border-top: solid 1px #aaa; - border-left: none; - border-right: none; - border-bottom: none; + border-left: none; + border-right: none; + border-bottom: none; } div#cgit table.ssdiff td.space { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/cgit.h new/cgit-1.0/cgit.h --- old/cgit-0.12/cgit.h 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/cgit.h 2016-06-07 14:45:04.000000000 +0200 @@ -29,13 +29,6 @@ #undef isgraph #define isgraph(x) (isprint((x)) && !isspace((x))) -/* - * Dateformats used on misc. pages - */ -#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" -#define FMT_SHORTDATE "%Y-%m-%d" -#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" - /* * Limits used for relative dates @@ -88,6 +81,7 @@ char *path; char *desc; char *owner; + char *homepage; char *defbranch; char *module_link; struct string_list readme; @@ -130,9 +124,11 @@ char *author; char *author_email; unsigned long author_date; + int author_tz; char *committer; char *committer_email; unsigned long committer_date; + int committer_tz; char *subject; char *msg; char *msg_encoding; @@ -142,6 +138,7 @@ char *tagger; char *tagger_email; unsigned long tagger_date; + int tagger_tz; char *msg; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/cgitrc.5.txt new/cgit-1.0/cgitrc.5.txt --- old/cgit-0.12/cgitrc.5.txt 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/cgitrc.5.txt 2016-06-07 14:45:04.000000000 +0200 @@ -205,11 +205,11 @@ Flag which, when set to "1", will allow cgit to use git config to set any repo specific settings. This option is used in conjunction with "scan-path", and must be defined prior, to augment repo-specific - settings. The keys gitweb.owner, gitweb.category, and gitweb.description - will map to the cgit keys repo.owner, repo.section, and repo.desc, - respectively. All git config keys that begin with "cgit." will be mapped - to the corresponding "repo." key in cgit. Default value: "0". See also: - scan-path, section-from-path. + settings. The keys gitweb.owner, gitweb.category, gitweb.description, + and gitweb.homepage will map to the cgit keys repo.owner, repo.section, + repo.desc, and repo.homepage respectively. All git config keys that begin + with "cgit." will be mapped to the corresponding "repo." key in cgit. + Default value: "0". See also: scan-path, section-from-path. favicon:: Url used as link to a shortcut icon for cgit. It is suggested to use @@ -496,6 +496,9 @@ repo.desc:: The value to show as repository description. Default value: none. +repo.homepage:: + The value to show as repository homepage. Default value: none. + repo.email-filter:: Override the default email-filter. Default value: none. See also: "enable-filter-overrides". See also: "FILTER API". @@ -520,7 +523,7 @@ A flag which can be used to override the global setting `enable-subject-links'. Default value: none. -enable-html-serving:: +repo.enable-html-serving:: A flag which can be used to override the global setting `enable-html-serving`. Default value: none. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/cmd.c new/cgit-1.0/cmd.c --- old/cgit-0.12/cmd.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/cmd.c 2016-06-07 14:45:04.000000000 +0200 @@ -39,16 +39,26 @@ static void about_fn(void) { if (ctx.repo) { + size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0; if (!ctx.qry.path && ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && - ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') { + (!path_info_len || ctx.env.path_info[path_info_len - 1] != '/')) { char *currenturl = cgit_currenturl(); char *redirect = fmtalloc("%s/", currenturl); cgit_redirect(redirect, true); free(currenturl); free(redirect); - } else + } else if (ctx.repo->readme.nr) cgit_print_repo_readme(ctx.qry.path); + else if (ctx.repo->homepage) + cgit_redirect(ctx.repo->homepage, false); + else { + char *currenturl = cgit_currenturl(); + char *redirect = fmtalloc("%s../", currenturl); + cgit_redirect(redirect, false); + free(currenturl); + free(redirect); + } } else cgit_print_site_readme(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/filters/html-converters/md2html new/cgit-1.0/filters/html-converters/md2html --- old/cgit-0.12/filters/html-converters/md2html 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/filters/html-converters/md2html 2016-06-07 14:45:04.000000000 +0200 @@ -1,5 +1,6 @@ #!/usr/bin/env python import markdown +from pygments.formatters import HtmlFormatter print(''' <style> .markdown-body { @@ -277,9 +278,12 @@ background-color: transparent; border: none; } +''') +print(HtmlFormatter(style='pastie').get_style_defs('.highlight')) +print(''' </style> ''') print("<div class='markdown-body'>") # Note: you may want to run this through bleach for sanitization -markdown.markdownFromFile(output_format="html5") +markdown.markdownFromFile(output_format="html5", extensions=["markdown.extensions.fenced_code", "markdown.extensions.codehilite", "markdown.extensions.tables"], extension_configs={"markdown.extensions.codehilite":{"css_class":"highlight"}}) print("</div>") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/filters/syntax-highlighting.py new/cgit-1.0/filters/syntax-highlighting.py --- old/cgit-0.12/filters/syntax-highlighting.py 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/filters/syntax-highlighting.py 2016-06-07 14:45:04.000000000 +0200 @@ -21,6 +21,7 @@ import sys +import io from pygments import highlight from pygments.util import ClassNotFound from pygments.lexers import TextLexer @@ -29,6 +30,8 @@ from pygments.formatters import HtmlFormatter +sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') data = sys.stdin.read() filename = sys.argv[1] formatter = HtmlFormatter(style='pastie') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/parsing.c new/cgit-1.0/parsing.c --- old/cgit-0.12/parsing.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/parsing.c 2016-06-07 14:45:04.000000000 +0200 @@ -69,7 +69,7 @@ return buf; } -static void parse_user(const char *t, char **name, char **email, unsigned long *date) +static void parse_user(const char *t, char **name, char **email, unsigned long *date, int *tz) { struct ident_split ident; unsigned email_len; @@ -83,6 +83,8 @@ if (ident.date_begin) *date = strtoul(ident.date_begin, NULL, 10); + if (ident.tz_begin) + *tz = atoi(ident.tz_begin); } } @@ -147,13 +149,13 @@ if (p && skip_prefix(p, "author ", &p)) { parse_user(p, &ret->author, &ret->author_email, - &ret->author_date); + &ret->author_date, &ret->author_tz); p = next_header_line(p); } if (p && skip_prefix(p, "committer ", &p)) { parse_user(p, &ret->committer, &ret->committer_email, - &ret->committer_date); + &ret->committer_date, &ret->committer_tz); p = next_header_line(p); } @@ -208,7 +210,7 @@ for (p = data; !end_of_header(p); p = next_header_line(p)) { if (skip_prefix(p, "tagger ", &p)) { parse_user(p, &ret->tagger, &ret->tagger_email, - &ret->tagger_date); + &ret->tagger_date, &ret->tagger_tz); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/scan-tree.c new/cgit-1.0/scan-tree.c --- old/cgit-0.12/scan-tree.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/scan-tree.c 2016-06-07 14:45:04.000000000 +0200 @@ -61,6 +61,8 @@ config_fn(repo, "desc", value); else if (!strcmp(key, "gitweb.category")) config_fn(repo, "section", value); + else if (!strcmp(key, "gitweb.homepage")) + config_fn(repo, "homepage", value); else if (starts_with(key, "cgit.")) config_fn(repo, key + 5, value); @@ -244,7 +246,7 @@ projectsfile, strerror(errno), errno); return; } - while (strbuf_getline(&line, projects, '\n') != EOF) { + while (strbuf_getline(&line, projects) != EOF) { if (!line.len) continue; strbuf_insert(&line, 0, "/", 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/shared.c new/cgit-1.0/shared.c --- old/cgit-0.12/shared.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/shared.c 2016-06-07 14:45:04.000000000 +0200 @@ -54,6 +54,7 @@ ret->path = NULL; ret->desc = cgit_default_repo_desc; ret->owner = NULL; + ret->homepage = NULL; ret->section = ctx.cfg.section; ret->snapshots = ctx.cfg.snapshots; ret->enable_commit_graph = ctx.cfg.enable_commit_graph; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-atom.c new/cgit-1.0/ui-atom.c --- old/cgit-0.12/ui-atom.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-atom.c 2016-06-07 14:45:04.000000000 +0200 @@ -25,7 +25,8 @@ html_txt(info->subject); html("</title>\n"); html("<updated>"); - cgit_print_date(info->committer_date, FMT_ATOMDATE, 0); + html_txt(show_date(info->committer_date, 0, + date_mode_from_type(DATE_ISO8601_STRICT))); html("</updated>\n"); html("<author>\n"); if (info->author) { @@ -50,7 +51,8 @@ } html("</author>\n"); html("<published>"); - cgit_print_date(info->author_date, FMT_ATOMDATE, 0); + html_txt(show_date(info->author_date, 0, + date_mode_from_type(DATE_ISO8601_STRICT))); html("</published>\n"); if (host) { char *pageurl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-commit.c new/cgit-1.0/ui-commit.c --- old/cgit-0.12/ui-commit.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-commit.c 2016-06-07 14:45:04.000000000 +0200 @@ -55,7 +55,8 @@ } cgit_close_filter(ctx.repo->email_filter); html("</td><td class='right'>"); - cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); + html_txt(show_date(info->author_date, info->author_tz, + cgit_date_mode(DATE_ISO8601))); html("</td></tr>\n"); html("<tr><th>committer</th><td>"); cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit"); @@ -66,7 +67,8 @@ } cgit_close_filter(ctx.repo->email_filter); html("</td><td class='right'>"); - cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); + html_txt(show_date(info->committer_date, info->committer_tz, + cgit_date_mode(DATE_ISO8601))); html("</td></tr>\n"); html("<tr><th>commit</th><td colspan='2' class='sha1'>"); tmp = oid_to_hex(&commit->object.oid); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-diff.c new/cgit-1.0/ui-diff.c --- old/cgit-0.12/ui-diff.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-diff.c 2016-06-07 14:45:04.000000000 +0200 @@ -340,7 +340,7 @@ html("<div class='cgit-panel'>"); html("<b>diff options</b>"); - html("<form method='get' action='.'>"); + html("<form method='get'>"); cgit_add_hidden_formfields(1, 0, ctx.qry.page); html("<table>"); html("<tr><td colspan='2'/></tr>"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-log.c new/cgit-1.0/ui-log.c --- old/cgit-0.12/ui-log.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-log.c 2016-06-07 14:45:04.000000000 +0200 @@ -61,38 +61,38 @@ buf[sizeof(buf) - 1] = 0; deco = get_name_decoration(&commit->object); + if (!deco) + return; html("<span class='decoration'>"); while (deco) { - if (starts_with(deco->name, "refs/heads/")) { - strncpy(buf, deco->name + 11, sizeof(buf) - 1); + strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1); + switch(deco->type) { + case DECORATION_NONE: + /* If the git-core doesn't recognize it, + * don't display anything. */ + break; + case DECORATION_REF_LOCAL: cgit_log_link(buf, NULL, "branch-deco", buf, NULL, - ctx.qry.vpath, 0, NULL, NULL, - ctx.qry.showmsg, 0); - } - else if (starts_with(deco->name, "tag: refs/tags/")) { - strncpy(buf, deco->name + 15, sizeof(buf) - 1); - cgit_tag_link(buf, NULL, "tag-deco", buf); - } - else if (starts_with(deco->name, "refs/tags/")) { - strncpy(buf, deco->name + 10, sizeof(buf) - 1); + ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, 0); + break; + case DECORATION_REF_TAG: cgit_tag_link(buf, NULL, "tag-deco", buf); - } - else if (starts_with(deco->name, "refs/remotes/")) { + break; + case DECORATION_REF_REMOTE: if (!ctx.repo->enable_remote_branches) - goto next; - strncpy(buf, deco->name + 13, sizeof(buf) - 1); + break; cgit_log_link(buf, NULL, "remote-deco", NULL, - oid_to_hex(&commit->object.oid), - ctx.qry.vpath, 0, NULL, NULL, - ctx.qry.showmsg, 0); - } - else { - strncpy(buf, deco->name, sizeof(buf) - 1); + oid_to_hex(&commit->object.oid), + ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, 0); + break; + default: cgit_commit_link(buf, NULL, "deco", ctx.qry.head, - oid_to_hex(&commit->object.oid), - ctx.qry.vpath); + oid_to_hex(&commit->object.oid), + ctx.qry.vpath); + break; } -next: deco = deco->next; } html("</span>"); @@ -141,7 +141,9 @@ /* When we get here we have precisely one parent. */ parent = parents->item; - parse_commit(parent); + /* If we can't parse the commit, let print_commit() report an error. */ + if (parse_commit(parent)) + return 1; files = 0; add_lines = 0; @@ -202,7 +204,7 @@ } else { html("<td>"); - cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); + cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); html("</td>"); } @@ -242,7 +244,7 @@ if (revs->graph) { html("</td><td>"); - cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); + cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); } if (!lines_counted && (ctx.repo->enable_log_filecount || diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-plain.c new/cgit-1.0/ui-plain.c --- old/cgit-0.12/ui-plain.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-plain.c 2016-06-07 14:45:04.000000000 +0200 @@ -143,7 +143,7 @@ walk_tree_ctx->match = 2; return READ_TREE_RECURSIVE; } - } else if (base->len > walk_tree_ctx->match_baselen) { + } else if (base->len < INT_MAX && (int)base->len > walk_tree_ctx->match_baselen) { print_dir_entry(sha1, base->buf, base->len, pathname, mode); walk_tree_ctx->match = 2; } else if (S_ISDIR(mode)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-refs.c new/cgit-1.0/ui-refs.c --- old/cgit-0.12/ui-refs.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-refs.c 2016-06-07 14:45:04.000000000 +0200 @@ -73,7 +73,7 @@ html_txt(info->author); cgit_close_filter(ctx.repo->email_filter); html("</td><td colspan='2'>"); - cgit_print_age(info->commit->date, -1, NULL); + cgit_print_age(info->committer_date, info->committer_tz, -1); } else { html("</td><td></td><td>"); cgit_object_link(ref->object); @@ -161,9 +161,9 @@ html("</td><td colspan='2'>"); if (info) { if (info->tagger_date > 0) - cgit_print_age(info->tagger_date, -1, NULL); + cgit_print_age(info->tagger_date, info->tagger_tz, -1); } else if (ref->object->type == OBJ_COMMIT) { - cgit_print_age(ref->commit->commit->date, -1, NULL); + cgit_print_age(ref->commit->commit->date, 0, -1); } html("</td></tr>\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-repolist.c new/cgit-1.0/ui-repolist.c --- old/cgit-0.12/ui-repolist.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-repolist.c 2016-06-07 14:45:04.000000000 +0200 @@ -79,7 +79,7 @@ { time_t t; if (get_repo_modtime(repo, &t)) - cgit_print_age(t, -1, NULL); + cgit_print_age(t, 0, -1); } static int is_match(struct cgit_repo *repo) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-shared.c new/cgit-1.0/ui-shared.c --- old/cgit-0.12/ui-shared.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-shared.c 2016-06-07 14:45:04.000000000 +0200 @@ -12,8 +12,7 @@ #include "html.h" static const char cgit_doctype[] = -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; +"<!DOCTYPE html>\n"; static char *http_date(time_t t) { @@ -607,35 +606,23 @@ path[len - 1] = tail; } -static const char *fmt_date(time_t secs, const char *format, int local_time) +const struct date_mode *cgit_date_mode(enum date_mode_type type) { - static char buf[64]; - struct tm *time; - - if (!secs) - return ""; - if (local_time) - time = localtime(&secs); - else - time = gmtime(&secs); - strftime(buf, sizeof(buf)-1, format, time); - return buf; -} - -void cgit_print_date(time_t secs, const char *format, int local_time) -{ - html_txt(fmt_date(secs, format, local_time)); + static struct date_mode mode; + mode.type = type; + mode.local = ctx.cfg.local_time; + return &mode; } -static void print_rel_date(time_t t, double value, +static void print_rel_date(time_t t, int tz, double value, const char *class, const char *suffix) { htmlf("<span class='%s' title='", class); - html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time)); + html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); htmlf("'>%.0f %s</span>", value, suffix); } -void cgit_print_age(time_t t, time_t max_relative, const char *format) +void cgit_print_age(time_t t, int tz, time_t max_relative) { time_t now, secs; @@ -648,34 +635,34 @@ if (secs > max_relative && max_relative >= 0) { html("<span title='"); - html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time)); + html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); html("'>"); - cgit_print_date(t, format, ctx.cfg.local_time); + html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT))); html("</span>"); return; } if (secs < TM_HOUR * 2) { - print_rel_date(t, secs * 1.0 / TM_MIN, "age-mins", "min."); + print_rel_date(t, tz, secs * 1.0 / TM_MIN, "age-mins", "min."); return; } if (secs < TM_DAY * 2) { - print_rel_date(t, secs * 1.0 / TM_HOUR, "age-hours", "hours"); + print_rel_date(t, tz, secs * 1.0 / TM_HOUR, "age-hours", "hours"); return; } if (secs < TM_WEEK * 2) { - print_rel_date(t, secs * 1.0 / TM_DAY, "age-days", "days"); + print_rel_date(t, tz, secs * 1.0 / TM_DAY, "age-days", "days"); return; } if (secs < TM_MONTH * 2) { - print_rel_date(t, secs * 1.0 / TM_WEEK, "age-weeks", "weeks"); + print_rel_date(t, tz, secs * 1.0 / TM_WEEK, "age-weeks", "weeks"); return; } if (secs < TM_YEAR * 2) { - print_rel_date(t, secs * 1.0 / TM_MONTH, "age-months", "months"); + print_rel_date(t, tz, secs * 1.0 / TM_MONTH, "age-months", "months"); return; } - print_rel_date(t, secs * 1.0 / TM_YEAR, "age-years", "years"); + print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years"); } void cgit_print_http_headers(void) @@ -714,7 +701,6 @@ html("Location: "); html_url_path(url); html("\n\n"); - exit(0); } static void print_rel_vcs_link(const char *url) @@ -736,7 +722,7 @@ char *host = cgit_hosturl(); html(cgit_doctype); - html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); + html("<html lang='en'>\n"); html("<head>\n"); html("<title>"); html_txt(ctx.page.title); @@ -792,7 +778,7 @@ else { htmlf("<div class='footer'>generated by <a href='http://git.zx2c4.com/cgit/about/'>cgit %s</a> at ", cgit_version); - cgit_print_date(time(NULL), FMT_LONGDATE, ctx.cfg.local_time); + html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_ISO8601))); html("</div>\n"); } html("</div> <!-- id=cgit -->\n"); @@ -805,13 +791,11 @@ ctx.page.expires = ctx.cfg.cache_dynamic_ttl; ctx.page.status = code; ctx.page.statusmsg = msg; - cgit_print_http_headers(); - cgit_print_docstart(); - cgit_print_pageheader(); + cgit_print_layout_start(); va_start(ap, fmt); cgit_vprint_error(fmt, ap); va_end(ap); - cgit_print_docend(); + cgit_print_layout_end(); } void cgit_print_layout_start(void) @@ -953,14 +937,14 @@ cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); if (ctx.env.authenticated) { html("</td><td class='form'>"); - html("<form method='get' action=''>\n"); + html("<form method='get'>\n"); cgit_add_hidden_formfields(0, 1, ctx.qry.page); html("<select name='h' onchange='this.form.submit();'>\n"); for_each_branch_ref(print_branch_option, ctx.qry.head); if (ctx.repo->enable_remote_branches) for_each_remote_ref(print_branch_option, ctx.qry.head); html("</select> "); - html("<input type='submit' name='' value='switch'/>"); + html("<input type='submit' value='switch'/>"); html("</form>"); } } else @@ -1009,6 +993,11 @@ if (ctx.repo->max_stats) cgit_stats_link("stats", NULL, hc("stats"), ctx.qry.head, ctx.qry.vpath); + if (ctx.repo->homepage) { + html("<a href='"); + html_attr(ctx.repo->homepage); + html("'>homepage</a>"); + } html("</td><td class='form'>"); html("<form class='right' method='get' action='"); if (ctx.cfg.virtual_root) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-shared.h new/cgit-1.0/ui-shared.h --- old/cgit-0.12/ui-shared.h 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-shared.h 2016-06-07 14:45:04.000000000 +0200 @@ -61,8 +61,8 @@ extern void cgit_print_error(const char *fmt, ...); __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); -extern void cgit_print_date(time_t secs, const char *format, int local_time); -extern void cgit_print_age(time_t t, time_t max_relative, const char *format); +extern const struct date_mode *cgit_date_mode(enum date_mode_type type); +extern void cgit_print_age(time_t t, int tz, time_t max_relative); extern void cgit_print_http_headers(void); extern void cgit_redirect(const char *url, bool permanent); extern void cgit_print_docstart(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-stats.c new/cgit-1.0/ui-stats.c --- old/cgit-0.12/ui-stats.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-stats.c 2016-06-07 14:45:04.000000000 +0200 @@ -3,12 +3,6 @@ #include "html.h" #include "ui-shared.h" -#ifdef NO_C99_FORMAT -#define SZ_FMT "%u" -#else -#define SZ_FMT "%zu" -#endif - struct authorstat { long total; struct string_list list; @@ -174,6 +168,7 @@ char *tmp; struct tm *date; time_t t; + uintptr_t *counter; info = cgit_parse_commit(commit); tmp = xstrdup(info->author); @@ -189,9 +184,11 @@ period->trunc(date); tmp = xstrdup(period->pretty(date)); item = string_list_insert(items, tmp); - if (item->util) + counter = (uintptr_t *)&item->util; + if (*counter) free(tmp); - item->util++; + (*counter)++; + authorstat->total++; cgit_free_commitinfo(info); } @@ -286,7 +283,7 @@ items = &authorstat->list; date = string_list_lookup(items, tmp); if (date) - subtotal += (size_t)date->util; + subtotal += (uintptr_t)date->util; } htmlf("<td class='%s'>%ld</td>", centerclass, subtotal); total += subtotal; @@ -340,8 +337,8 @@ if (!date) html("<td>0</td>"); else { - htmlf("<td>"SZ_FMT"</td>", (size_t)date->util); - total += (size_t)date->util; + htmlf("<td>%lu</td>", (uintptr_t)date->util); + total += (uintptr_t)date->util; } } htmlf("<td class='sum'>%ld</td></tr>", total); @@ -392,7 +389,7 @@ cgit_print_layout_start(); html("<div class='cgit-panel'>"); html("<b>stat options</b>"); - html("<form method='get' action=''>"); + html("<form method='get'>"); cgit_add_hidden_formfields(1, 0, "stats"); html("<table><tr><td colspan='2'/></tr>"); if (ctx.repo->max_stats > 1) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-tag.c new/cgit-1.0/ui-tag.c --- old/cgit-0.12/ui-tag.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-tag.c 2016-06-07 14:45:04.000000000 +0200 @@ -76,7 +76,8 @@ htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1)); if (info->tagger_date > 0) { html("<tr><td>tag date</td><td>"); - cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time); + html_txt(show_date(info->tagger_date, info->tagger_tz, + cgit_date_mode(DATE_ISO8601))); html("</td></tr>\n"); } if (info->tagger) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgit-0.12/ui-tree.c new/cgit-1.0/ui-tree.c --- old/cgit-0.12/ui-tree.c 2016-01-14 15:43:54.000000000 +0100 +++ new/cgit-1.0/ui-tree.c 2016-06-07 14:45:04.000000000 +0200 @@ -84,6 +84,37 @@ html("</table>\n"); } +static void set_title_from_path(const char *path) +{ + size_t path_len, path_index, path_last_end; + char *new_title; + + if (!path) + return; + + path_len = strlen(path); + new_title = xmalloc(path_len + 3 + strlen(ctx.page.title) + 1); + new_title[0] = '\0'; + + for (path_index = path_len, path_last_end = path_len; path_index-- > 0;) { + if (path[path_index] == '/') { + if (path_index == path_len - 1) { + path_last_end = path_index - 1; + continue; + } + strncat(new_title, &path[path_index + 1], path_last_end - path_index - 1); + strcat(new_title, "\\"); + path_last_end = path_index; + } + } + if (path_last_end) + strncat(new_title, path, path_last_end); + + strcat(new_title, " - "); + strcat(new_title, ctx.page.title); + ctx.page.title = new_title; +} + static void print_object(const unsigned char *sha1, char *path, const char *basename, const char *rev) { enum object_type type; @@ -104,6 +135,8 @@ return; } + set_title_from_path(path); + cgit_print_layout_start(); htmlf("blob: %s (", sha1_to_hex(sha1)); cgit_plain_link("plain", NULL, NULL, ctx.qry.head, @@ -235,6 +268,7 @@ if (S_ISDIR(mode)) { walk_tree_ctx->state = 1; + set_title_from_path(buffer); ls_head(); return READ_TREE_RECURSIVE; } else { ++++++ git-2.7.0.tar.xz -> git-2.8.3.tar.xz ++++++ ++++ 126057 lines of diff (skipped)
