From 57ea1aa2a5eab7f6aba702b3366fe4dcc72124f6 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:01 +0000 Subject: ui-shared: remove "format" from cgit_print_age() We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping --- ui-log.c | 4 ++-- ui-refs.c | 6 +++--- ui-repolist.c | 2 +- ui-shared.c | 4 ++-- ui-shared.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ui-log.c b/ui-log.c index a4dc707..5f6a69c 100644 --- a/ui-log.c +++ b/ui-log.c @@ -204,7 +204,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) } else { html(""); - cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); + cgit_print_age(commit->date, TM_WEEK * 2); html(""); } @@ -244,7 +244,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) if (revs->graph) { html(""); - cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); + cgit_print_age(commit->date, TM_WEEK * 2); } if (!lines_counted && (ctx.repo->enable_log_filecount || diff --git a/ui-refs.c b/ui-refs.c index 295a4c7..0652b89 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -73,7 +73,7 @@ static int print_branch(struct refinfo *ref) html_txt(info->author); cgit_close_filter(ctx.repo->email_filter); html(""); - cgit_print_age(info->commit->date, -1, NULL); + cgit_print_age(info->commit->date, -1); } else { html(""); cgit_object_link(ref->object); @@ -161,9 +161,9 @@ static int print_tag(struct refinfo *ref) html(""); if (info) { if (info->tagger_date > 0) - cgit_print_age(info->tagger_date, -1, NULL); + cgit_print_age(info->tagger_date, -1); } else if (ref->object->type == OBJ_COMMIT) { - cgit_print_age(ref->commit->commit->date, -1, NULL); + cgit_print_age(ref->commit->commit->date, -1); } html("\n"); diff --git a/ui-repolist.c b/ui-repolist.c index 6010a39..6004469 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -79,7 +79,7 @@ static void print_modtime(struct cgit_repo *repo) { time_t t; if (get_repo_modtime(repo, &t)) - cgit_print_age(t, -1, NULL); + cgit_print_age(t, -1); } static int is_match(struct cgit_repo *repo) diff --git a/ui-shared.c b/ui-shared.c index 54bbde7..76aac60 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -635,7 +635,7 @@ static void print_rel_date(time_t t, double value, htmlf("'>%.0f %s", value, suffix); } -void cgit_print_age(time_t t, time_t max_relative, const char *format) +void cgit_print_age(time_t t, time_t max_relative) { time_t now, secs; @@ -650,7 +650,7 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format) html(""); - cgit_print_date(t, format, ctx.cfg.local_time); + cgit_print_date(t, FMT_SHORTDATE, ctx.cfg.local_time); html(""); return; } diff --git a/ui-shared.h b/ui-shared.h index de08e1b..c9413ed 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -62,7 +62,7 @@ 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 void cgit_print_age(time_t t, 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); -- cgit v1.2.3 From 45c87ca1c32dcd5ffd4a681fadf05627d9ce7770 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:02 +0000 Subject: parsing: add timezone to ident structures This will allow us to mimic Git's behaviour of showing times in the originator's timezone when displaying commits and tags. Signed-off-by: John Keeping --- cgit.h | 3 +++ parsing.c | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cgit.h b/cgit.h index de5c94a..501cb48 100644 --- a/cgit.h +++ b/cgit.h @@ -130,9 +130,11 @@ struct commitinfo { 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 +144,7 @@ struct taginfo { char *tagger; char *tagger_email; unsigned long tagger_date; + int tagger_tz; char *msg; }; diff --git a/parsing.c b/parsing.c index 5283e58..9dacb16 100644 --- a/parsing.c +++ b/parsing.c @@ -69,7 +69,7 @@ static char *substr(const char *head, const char *tail) 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 @@ static void parse_user(const char *t, char **name, char **email, unsigned long * if (ident.date_begin) *date = strtoul(ident.date_begin, NULL, 10); + if (ident.tz_begin) + *tz = atoi(ident.tz_begin); } } @@ -147,13 +149,13 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) 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 @@ struct taginfo *cgit_parse_tag(struct tag *tag) 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); } } -- cgit v1.2.3 From 360af46fac6fe79ec1868141a6c34b4c6b732ba0 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:03 +0000 Subject: ui-shared: add cgit_date_mode() This returns the correct mode value for use with Git's show_date() based on the current CGit configuration and will be used in the following patches. Signed-off-by: John Keeping --- ui-shared.c | 9 +++++++++ ui-shared.h | 1 + 2 files changed, 10 insertions(+) diff --git a/ui-shared.c b/ui-shared.c index 76aac60..923d102 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -627,6 +627,15 @@ void cgit_print_date(time_t secs, const char *format, int local_time) html_txt(fmt_date(secs, format, local_time)); } +const struct date_mode *cgit_date_mode(const char *format) +{ + static struct date_mode mode; + mode.type = DATE_STRFTIME; + mode.strftime_fmt = format; + mode.local = ctx.cfg.local_time; + return &mode; +} + static void print_rel_date(time_t t, double value, const char *class, const char *suffix) { diff --git a/ui-shared.h b/ui-shared.h index c9413ed..707cec9 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -61,6 +61,7 @@ __attribute__((format (printf,1,2))) 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 const struct date_mode *cgit_date_mode(const char *format); 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); extern void cgit_print_http_headers(void); -- cgit v1.2.3 From 21dcf10386551a2eee3e552c3213bb14e535cbba Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:04 +0000 Subject: ui-{commit,tag}: show dates in originator's timezone This is done by switching to Git's show_date() function and the mode given by cgit_date_mode(). Signed-off-by: John Keeping --- ui-commit.c | 6 ++++-- ui-tag.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ui-commit.c b/ui-commit.c index 0c3d740..e697571 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -55,7 +55,8 @@ void cgit_print_commit(char *hex, const char *prefix) } cgit_close_filter(ctx.repo->email_filter); html(""); - 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(FMT_LONGDATE))); html("\n"); html("committer"); cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit"); @@ -66,7 +67,8 @@ void cgit_print_commit(char *hex, const char *prefix) } cgit_close_filter(ctx.repo->email_filter); html(""); - 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(FMT_LONGDATE))); html("\n"); html("commit"); tmp = oid_to_hex(&commit->object.oid); diff --git a/ui-tag.c b/ui-tag.c index 0afc663..b011198 100644 --- a/ui-tag.c +++ b/ui-tag.c @@ -76,7 +76,8 @@ void cgit_print_tag(char *revname) htmlf(" (%s)\n", sha1_to_hex(sha1)); if (info->tagger_date > 0) { html("tag date"); - 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(FMT_LONGDATE))); html("\n"); } if (info->tagger) { -- cgit v1.2.3 From f2a901d2e1db5217d6890b26c6dc1ec119505d02 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:05 +0000 Subject: ui: show ages in the originator's timezone This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping --- ui-log.c | 4 ++-- ui-refs.c | 6 +++--- ui-repolist.c | 2 +- ui-shared.c | 22 +++++++++++----------- ui-shared.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ui-log.c b/ui-log.c index 5f6a69c..0a3938b 100644 --- a/ui-log.c +++ b/ui-log.c @@ -204,7 +204,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) } else { html(""); - cgit_print_age(commit->date, TM_WEEK * 2); + cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); html(""); } @@ -244,7 +244,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) if (revs->graph) { html(""); - cgit_print_age(commit->date, TM_WEEK * 2); + cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); } if (!lines_counted && (ctx.repo->enable_log_filecount || diff --git a/ui-refs.c b/ui-refs.c index 0652b89..5b4530e 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -73,7 +73,7 @@ static int print_branch(struct refinfo *ref) html_txt(info->author); cgit_close_filter(ctx.repo->email_filter); html(""); - cgit_print_age(info->commit->date, -1); + cgit_print_age(info->committer_date, info->committer_tz, -1); } else { html(""); cgit_object_link(ref->object); @@ -161,9 +161,9 @@ static int print_tag(struct refinfo *ref) html(""); if (info) { if (info->tagger_date > 0) - cgit_print_age(info->tagger_date, -1); + 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); + cgit_print_age(ref->commit->commit->date, 0, -1); } html("\n"); diff --git a/ui-repolist.c b/ui-repolist.c index 6004469..30915df 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -79,7 +79,7 @@ static void print_modtime(struct cgit_repo *repo) { time_t t; if (get_repo_modtime(repo, &t)) - cgit_print_age(t, -1); + cgit_print_age(t, 0, -1); } static int is_match(struct cgit_repo *repo) diff --git a/ui-shared.c b/ui-shared.c index 923d102..3ce86fe 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -636,15 +636,15 @@ const struct date_mode *cgit_date_mode(const char *format) 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("%.0f %s", value, suffix); } -void cgit_print_age(time_t t, time_t max_relative) +void cgit_print_age(time_t t, int tz, time_t max_relative) { time_t now, secs; @@ -657,34 +657,34 @@ void cgit_print_age(time_t t, time_t max_relative) if (secs > max_relative && max_relative >= 0) { html(""); - cgit_print_date(t, FMT_SHORTDATE, ctx.cfg.local_time); + html_txt(show_date(t, tz, cgit_date_mode(FMT_SHORTDATE))); html(""); 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) diff --git a/ui-shared.h b/ui-shared.h index 707cec9..e42f13a 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -63,7 +63,7 @@ __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); extern const struct date_mode *cgit_date_mode(const char *format); 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); +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); -- cgit v1.2.3 From e68c86e8c54a6f03e7405dff3d38995c6c42e4fa Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:06 +0000 Subject: ui-shared: use show_date for footer timestamp Signed-off-by: John Keeping --- ui-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index 3ce86fe..eaa45fb 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -801,7 +801,7 @@ void cgit_print_docend(void) else { htmlf("\n"); } html(" \n"); -- cgit v1.2.3 From eb80b4edadd07957f667f057c82875c30a822a1f Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:07 +0000 Subject: ui-atom: use show_date directly for atom dates This will allow us to remove cgit_print_date and use Git's show_date consistently. Signed-off-by: John Keeping --- ui-atom.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui-atom.c b/ui-atom.c index 11ea0c0..0bf2cf2 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -17,6 +17,11 @@ static void add_entry(struct commit *commit, const char *host) char *hex; char *mail, *t, *t2; struct commitinfo *info; + struct date_mode mode = { + .type = DATE_STRFTIME, + .strftime_fmt = FMT_ATOMDATE, + .local = 0, + }; info = cgit_parse_commit(commit); hex = oid_to_hex(&commit->object.oid); @@ -25,7 +30,7 @@ static void add_entry(struct commit *commit, const char *host) html_txt(info->subject); html("\n"); html(""); - cgit_print_date(info->committer_date, FMT_ATOMDATE, 0); + html_txt(show_date(info->committer_date, 0, &mode)); html("\n"); html("\n"); if (info->author) { @@ -50,7 +55,7 @@ static void add_entry(struct commit *commit, const char *host) } html("\n"); html(""); - cgit_print_date(info->author_date, FMT_ATOMDATE, 0); + html_txt(show_date(info->author_date, 0, &mode)); html("\n"); if (host) { char *pageurl; -- cgit v1.2.3 From 17c74eefa4390d42a244b12885dc63ac4a764e44 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:08 +0000 Subject: ui-shared: remove cgit_print_date() There are no longer any users of this function. Signed-off-by: John Keeping --- ui-shared.c | 20 -------------------- ui-shared.h | 1 - 2 files changed, 21 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index eaa45fb..d1f9249 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -607,26 +607,6 @@ void cgit_submodule_link(const char *class, char *path, const char *rev) path[len - 1] = tail; } -static const char *fmt_date(time_t secs, const char *format, int local_time) -{ - 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)); -} - const struct date_mode *cgit_date_mode(const char *format) { static struct date_mode mode; diff --git a/ui-shared.h b/ui-shared.h index e42f13a..43789de 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -62,7 +62,6 @@ 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 const struct date_mode *cgit_date_mode(const char *format); -extern void cgit_print_date(time_t secs, const char *format, int local_time); 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); -- cgit v1.2.3 From 85ec9f0211a0c83d6cca744e6e40d73daf4050fc Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 8 Feb 2016 09:06:47 +0100 Subject: git: update to v2.7.1 Update to git version v2.7.1, no changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6590d8e..8bd7a0e 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.7.0 +GIT_VER = 2.7.1 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index 7548842..a08595f 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 754884255bb580df159e58defa81cdd30b5c430c +Subproject commit a08595f76159b09d57553e37a5123f1091bb13e7 -- cgit v1.2.3 From a8b9ef8c1c68fbb9c89db2d8c12dca38c15e2bfd Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 8 Feb 2016 14:35:47 +0100 Subject: ui-stats: if we're going to abuse void*, do it safely --- ui-stats.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ui-stats.c b/ui-stats.c index 74ce0f7..a9c13fd 100644 --- a/ui-stats.c +++ b/ui-stats.c @@ -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 @@ static void add_commit(struct string_list *authors, struct commit *commit, char *tmp; struct tm *date; time_t t; + uintptr_t *counter; info = cgit_parse_commit(commit); tmp = xstrdup(info->author); @@ -191,7 +186,9 @@ static void add_commit(struct string_list *authors, struct commit *commit, item = string_list_insert(items, tmp); if (item->util) free(tmp); - item->util++; + counter = (uintptr_t *)&item->util; + (*counter)++; + authorstat->total++; cgit_free_commitinfo(info); } @@ -286,7 +283,7 @@ static void print_combined_authorrow(struct string_list *authors, int from, items = &authorstat->list; date = string_list_lookup(items, tmp); if (date) - subtotal += (size_t)date->util; + subtotal += (uintptr_t)date->util; } htmlf("%ld", centerclass, subtotal); total += subtotal; @@ -340,8 +337,8 @@ static void print_authors(struct string_list *authors, int top, if (!date) html("0"); else { - htmlf(""SZ_FMT"", (size_t)date->util); - total += (size_t)date->util; + htmlf("%lu", (uintptr_t)date->util); + total += (uintptr_t)date->util; } } htmlf("%ld", total); -- cgit v1.2.3 From bdcbe0922d7099ebd61d875709ea9408bc1d7543 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 8 Feb 2016 14:12:35 +0000 Subject: ui-stats: cast pointer before checking for zero We abuse the "void *util" field as a counter and recently started to cast it to a uintptr_t to avoid risking nasal demons by performing arithmetic on a void pointer. However, compilers are also known to do "interesting" things if they know that a pointer is or isn't NULL. Make this safer by checking if the counter (after casting) is non-zero rather than checking if the pointer is non-null. Signed-off-by: John Keeping --- ui-stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-stats.c b/ui-stats.c index a9c13fd..8cd9178 100644 --- a/ui-stats.c +++ b/ui-stats.c @@ -184,9 +184,9 @@ static void add_commit(struct string_list *authors, struct commit *commit, period->trunc(date); tmp = xstrdup(period->pretty(date)); item = string_list_insert(items, tmp); - if (item->util) - free(tmp); counter = (uintptr_t *)&item->util; + if (*counter) + free(tmp); (*counter)++; authorstat->total++; -- cgit v1.2.3 From 9c15f3c6954e43c5ffd36230e666eccf112803f2 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 8 Feb 2016 15:05:54 +0000 Subject: Avoid DATE_STRFTIME for long/short dates Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping --- cgit.h | 2 -- ui-commit.c | 4 ++-- ui-shared.c | 13 ++++++------- ui-shared.h | 2 +- ui-tag.c | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cgit.h b/cgit.h index 501cb48..5adef4d 100644 --- a/cgit.h +++ b/cgit.h @@ -32,8 +32,6 @@ /* * 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" diff --git a/ui-commit.c b/ui-commit.c index e697571..099d294 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -56,7 +56,7 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_close_filter(ctx.repo->email_filter); html(""); html_txt(show_date(info->author_date, info->author_tz, - cgit_date_mode(FMT_LONGDATE))); + cgit_date_mode(DATE_ISO8601))); html("\n"); html("committer"); cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit"); @@ -68,7 +68,7 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_close_filter(ctx.repo->email_filter); html(""); html_txt(show_date(info->committer_date, info->committer_tz, - cgit_date_mode(FMT_LONGDATE))); + cgit_date_mode(DATE_ISO8601))); html("\n"); html("commit"); tmp = oid_to_hex(&commit->object.oid); diff --git a/ui-shared.c b/ui-shared.c index d1f9249..03dcc08 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -607,11 +607,10 @@ void cgit_submodule_link(const char *class, char *path, const char *rev) path[len - 1] = tail; } -const struct date_mode *cgit_date_mode(const char *format) +const struct date_mode *cgit_date_mode(enum date_mode_type type) { static struct date_mode mode; - mode.type = DATE_STRFTIME; - mode.strftime_fmt = format; + mode.type = type; mode.local = ctx.cfg.local_time; return &mode; } @@ -620,7 +619,7 @@ static void print_rel_date(time_t t, int tz, double value, const char *class, const char *suffix) { htmlf("%.0f %s", value, suffix); } @@ -637,9 +636,9 @@ void cgit_print_age(time_t t, int tz, time_t max_relative) if (secs > max_relative && max_relative >= 0) { html(""); - html_txt(show_date(t, tz, cgit_date_mode(FMT_SHORTDATE))); + html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT))); html(""); return; } @@ -781,7 +780,7 @@ void cgit_print_docend(void) else { htmlf("\n"); } html(" \n"); diff --git a/ui-shared.h b/ui-shared.h index 43789de..b457c97 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -61,7 +61,7 @@ __attribute__((format (printf,1,2))) 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 const struct date_mode *cgit_date_mode(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); diff --git a/ui-tag.c b/ui-tag.c index b011198..6b838cb 100644 --- a/ui-tag.c +++ b/ui-tag.c @@ -77,7 +77,7 @@ void cgit_print_tag(char *revname) if (info->tagger_date > 0) { html("tag date"); html_txt(show_date(info->tagger_date, info->tagger_tz, - cgit_date_mode(FMT_LONGDATE))); + cgit_date_mode(DATE_ISO8601))); html("\n"); } if (info->tagger) { -- cgit v1.2.3 From 75298209bf8386656b82f185e2901690ac5b671c Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 8 Feb 2016 15:06:27 +0000 Subject: ui-atom: avoid DATE_STRFTIME Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since Atom accepts ISO8601 dates [1], we can use Git's DATE_ISO8601_STRICT instead, which does get this right. Additionally, we never use the local timezone here so we can use the date_mode_from_type() wrapper to simplify the code a bit. [1] https://tools.ietf.org/html/rfc4287#section-3.3 Signed-off-by: John Keeping --- cgit.h | 5 ----- ui-atom.c | 11 ++++------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/cgit.h b/cgit.h index 5adef4d..d10c799 100644 --- a/cgit.h +++ b/cgit.h @@ -29,11 +29,6 @@ #undef isgraph #define isgraph(x) (isprint((x)) && !isspace((x))) -/* - * Dateformats used on misc. pages - */ -#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" - /* * Limits used for relative dates diff --git a/ui-atom.c b/ui-atom.c index 0bf2cf2..41838d3 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -17,11 +17,6 @@ static void add_entry(struct commit *commit, const char *host) char *hex; char *mail, *t, *t2; struct commitinfo *info; - struct date_mode mode = { - .type = DATE_STRFTIME, - .strftime_fmt = FMT_ATOMDATE, - .local = 0, - }; info = cgit_parse_commit(commit); hex = oid_to_hex(&commit->object.oid); @@ -30,7 +25,8 @@ static void add_entry(struct commit *commit, const char *host) html_txt(info->subject); html("\n"); html(""); - html_txt(show_date(info->committer_date, 0, &mode)); + html_txt(show_date(info->committer_date, 0, + date_mode_from_type(DATE_ISO8601_STRICT))); html("\n"); html("\n"); if (info->author) { @@ -55,7 +51,8 @@ static void add_entry(struct commit *commit, const char *host) } html("\n"); html(""); - html_txt(show_date(info->author_date, 0, &mode)); + html_txt(show_date(info->author_date, 0, + date_mode_from_type(DATE_ISO8601_STRICT))); html("\n"); if (host) { char *pageurl; -- cgit v1.2.3 From 5f2664f13c90f083b827d8fafa6cfc01c0c4f513 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 22 Feb 2016 16:04:15 +0100 Subject: ui-shared: add homepage to tabs Signed-off-by: Jason A. Donenfeld --- cgit.c | 4 ++++ cgit.css | 5 +++++ cgit.h | 1 + cgitrc.5.txt | 13 ++++++++----- scan-tree.c | 2 ++ shared.c | 1 + ui-shared.c | 5 +++++ 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/cgit.c b/cgit.c index 7f83a2d..fc482be 100644 --- a/cgit.c +++ b/cgit.c @@ -41,6 +41,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va 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 @@ static void print_repo(FILE *f, struct cgit_repo *repo) 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 --git a/cgit.css b/cgit.css index 82c755c..50f6587 100644 --- a/cgit.css +++ b/cgit.css @@ -85,6 +85,11 @@ div#cgit table.tabs td a.active { 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,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAABQAAAAUAVyMgXwAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAeklEQVQI12NoYCu3q3ABwXL98vTy/0D4jaF8XXldRRoYejAwlu8BCTOU72SAg4q08j/le0GC22BC5anlfyrSGBiBGCZYllz+pywLJg8WLOMtf1GeCjRgI5IgSBhMboUIHq40r1CCQrfyDRAV6uXdZTMhsKKlVIIBFwAAVeg4KFYK95cAAAAASUVORK5CYII=); + margin: 0 0 0 5px; +} + div#cgit table.tabs td.form { text-align: right; } diff --git a/cgit.h b/cgit.h index d10c799..325432b 100644 --- a/cgit.h +++ b/cgit.h @@ -81,6 +81,7 @@ struct cgit_repo { char *path; char *desc; char *owner; + char *homepage; char *defbranch; char *module_link; struct string_list readme; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 47850a8..94901bd 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -205,11 +205,11 @@ enable-git-config:: 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.defbranch:: 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". diff --git a/scan-tree.c b/scan-tree.c index b5a10ff..2e87999 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -61,6 +61,8 @@ static int gitconfig_config(const char *key, const char *value, void *cb) 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); diff --git a/shared.c b/shared.c index a078a27..a63633b 100644 --- a/shared.c +++ b/shared.c @@ -54,6 +54,7 @@ struct cgit_repo *cgit_add_repo(const char *url) 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 --git a/ui-shared.c b/ui-shared.c index 03dcc08..2c91e75 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -997,6 +997,11 @@ void cgit_print_pageheader(void) if (ctx.repo->max_stats) cgit_stats_link("stats", NULL, hc("stats"), ctx.qry.head, ctx.qry.vpath); + if (ctx.repo->homepage) { + html("homepage"); + } html(""); html("
Signed-off-by: Jason A. Donenfeld --- ui-plain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-plain.c b/ui-plain.c index ff85113..97cf639 100644 --- a/ui-plain.c +++ b/ui-plain.c @@ -143,7 +143,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base, 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)) { -- cgit v1.2.3 From a9e9dfc55f5c57a4065be77c320224f524a9c820 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 22 Feb 2016 23:25:28 +0100 Subject: git: update to v2.7.2 Update to git version v2.7.2, no changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8bd7a0e..c01701c 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.7.1 +GIT_VER = 2.7.2 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index a08595f..326e5bc 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit a08595f76159b09d57553e37a5123f1091bb13e7 +Subproject commit 326e5bc91eecf73234ead29636207bc516573e79 -- cgit v1.2.3 From 1892cd9a603e1eda206c40efb576bd75b7532be6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 23 Feb 2016 06:32:03 +0100 Subject: md2html: Do syntax highlighting too --- filters/html-converters/md2html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html index 67141ba..c8ee7d9 100755 --- a/filters/html-converters/md2html +++ b/filters/html-converters/md2html @@ -1,5 +1,6 @@ #!/usr/bin/env python import markdown +from pygments.formatters import HtmlFormatter print(''' ''') print("
") # 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("
") -- cgit v1.2.3 From a0d22c391e6e2bbe0d10a888df1ba77a468d5a18 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 23 Feb 2016 10:47:25 +0100 Subject: css: use less blurry icon for external link Your mileage may vary, but for me the old icon looks blurry. The new one is character 0xf08e from OTF font awsome in size 10. The icon color is black, gray level is adjusted via opacity. Signed-off-by: Christian Hesse --- cgit.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cgit.css b/cgit.css index 50f6587..942c9be 100644 --- a/cgit.css +++ b/cgit.css @@ -86,7 +86,8 @@ div#cgit table.tabs td a.active { } div#cgit table.tabs a[href^="http://"]:after, div#cgit table.tabs a[href^="https://"]:after { - content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAABQAAAAUAVyMgXwAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAeklEQVQI12NoYCu3q3ABwXL98vTy/0D4jaF8XXldRRoYejAwlu8BCTOU72SAg4q08j/le0GC22BC5anlfyrSGBiBGCZYllz+pywLJg8WLOMtf1GeCjRgI5IgSBhMboUIHq40r1CCQrfyDRAV6uXdZTMhsKKlVIIBFwAAVeg4KFYK95cAAAAASUVORK5CYII=); + content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgAhcJDQY+gm2TAAAAHWlUWHRDb21tZW50AAAAAABDcmVhdGVkIHdpdGggR0lNUGQuZQcAAABbSURBVAhbY2BABs4MU4CwhYHBh2Erww4wrGFQZHjI8B8IgUIscJWyDHcggltQhI4zGDCcRwhChPggHIggP1QoAVmQkSETrGoHsiAEsACtBYN0oDAMbgU6EBcAAL2eHUt4XUU4AAAAAElFTkSuQmCC); + opacity: 0.5; margin: 0 0 0 5px; } -- cgit v1.2.3 From 46ff6e1993175057a18b14980696648a1c5e87ab Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 23 Feb 2016 15:14:06 +0100 Subject: css: fix indentation --- cgit.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cgit.css b/cgit.css index 942c9be..66c6d53 100644 --- a/cgit.css +++ b/cgit.css @@ -18,7 +18,7 @@ div#cgit a:hover { } div#cgit table { - border-collapse: collapse; + border-collapse: collapse; } div#cgit table#header { @@ -803,9 +803,9 @@ div#cgit table.ssdiff td.head div.head { 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 { -- cgit v1.2.3 From c424b5cb0253d8b55d3932efa51aa703dab2bf40 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 23 Feb 2016 15:35:32 +0100 Subject: tabs: do not use target=_blank --- ui-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index 2c91e75..3b2dc06 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1000,7 +1000,7 @@ void cgit_print_pageheader(void) if (ctx.repo->homepage) { html("homepage"); + html("'>homepage"); } html(""); html(" Date: Fri, 26 Feb 2016 13:24:35 +0100 Subject: ui-shared: redirect should not exit early for cache Signed-off-by: Jason A. Donenfeld --- ui-shared.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index 3b2dc06..9a38aa9 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -702,7 +702,6 @@ void cgit_redirect(const char *url, bool permanent) html("Location: "); html_url_path(url); html("\n\n"); - exit(0); } static void print_rel_vcs_link(const char *url) -- cgit v1.2.3 From 39735d95ca8775204ed4c5f306009707f7da79c6 Mon Sep 17 00:00:00 2001 From: Matt Comben Date: Tue, 8 Mar 2016 12:05:09 +0000 Subject: Renamed repo-specific configuration for enable-html-serving in cgitrc.5.txt --- cgitrc.5.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 94901bd..2e1912d 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -523,7 +523,7 @@ repo.enable-subject-links:: 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. -- cgit v1.2.3 From 499b23979cd29513df16e4c2acce934932e09f7a Mon Sep 17 00:00:00 2001 From: Tim Nordell Date: Fri, 26 Feb 2016 14:57:30 -0600 Subject: ui-log: Do not always emit decoration span The decoration span does not need to be emited if there aren't any decorations to show. This modification saves slightly on bandwidth. Signed-off-by: Tim Nordell --- ui-log.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui-log.c b/ui-log.c index 0a3938b..641a5b6 100644 --- a/ui-log.c +++ b/ui-log.c @@ -61,6 +61,8 @@ void show_commit_decorations(struct commit *commit) buf[sizeof(buf) - 1] = 0; deco = get_name_decoration(&commit->object); + if (!deco) + return; html(""); while (deco) { if (starts_with(deco->name, "refs/heads/")) { -- cgit v1.2.3 From 59d8fa1a62e7c19911fdf7ee9ceb0fdf8fa3331c Mon Sep 17 00:00:00 2001 From: Tim Nordell Date: Fri, 26 Feb 2016 14:58:41 -0600 Subject: ui-log: Simplify decoration code The decoration code inside of git returns the decoration type, so utilize this to create the decoration spans. Additionally, use prettify_refname(...) to get the shorter name for the ref. Signed-off-by: Tim Nordell --- ui-log.c | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/ui-log.c b/ui-log.c index 641a5b6..d6d94f6 100644 --- a/ui-log.c +++ b/ui-log.c @@ -65,36 +65,34 @@ void show_commit_decorations(struct commit *commit) return; html(""); 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(""); -- cgit v1.2.3 From 86bf5b47916fbe53fe637d7181e93a34d2ad6d0c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 30 Apr 2016 16:57:51 +0200 Subject: git: update to v2.8.2 Update to git version v2.8.2. * Upstream commit 1a0c8dfd89475d6bb09ddee8c019cf0ae5b3bdc2 (strbuf: give strbuf_getline() to the "most text friendly" variant) changed API. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- scan-tree.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c01701c..a7aa08b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.7.2 +GIT_VER = 2.8.2 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index 326e5bc..60115f5 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 326e5bc91eecf73234ead29636207bc516573e79 +Subproject commit 60115f54bda3a127ed3cc8ffc6ab6c771cbceb1b diff --git a/scan-tree.c b/scan-tree.c index 2e87999..1cb4e5d 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -246,7 +246,7 @@ void scan_projects(const char *path, const char *projectsfile, repo_config_fn fn 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); -- cgit v1.2.3 From 80f12b3e7e43edcb06aea9811b790b16ca204c81 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Wed, 11 May 2016 17:50:09 +0000 Subject: ui-shared: Simplify cgit_print_error_page() logic --- ui-shared.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index 9a38aa9..bf92747 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -792,13 +792,11 @@ void cgit_print_error_page(int code, const char *msg, const char *fmt, ...) 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) -- cgit v1.2.3 From 8d05b398bb1f4effcb59dddc62a3ea1f021f8631 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Wed, 11 May 2016 18:04:14 +0000 Subject: ui-shared: HTML-ize DOCTYPE and Get rid of the XHTML headers, bringing cgit slowly to the modern age of HTML. --- ui-shared.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index bf92747..1529ff1 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -12,8 +12,7 @@ #include "html.h" static const char cgit_doctype[] = -"\n"; +"\n"; static char *http_date(time_t t) { @@ -723,7 +722,7 @@ void cgit_print_docstart(void) char *host = cgit_hosturl(); html(cgit_doctype); - html("\n"); + html("\n"); html("\n"); html(""); html_txt(ctx.page.title); -- cgit v1.2.3 From 9afda36ed72083febca5e1a249b7f9f09205fe16 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi <wub@partyvan.eu> Date: Wed, 11 May 2016 18:04:18 +0000 Subject: ui-shared: Remove a name attribute with an empty value The name attribute is optional in an input element, but it must not be an empty value. See: https://html.spec.whatwg.org/#attr-fe-name See: https://html.spec.whatwg.org/#the-input-element --- ui-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index 1529ff1..770b685 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -944,7 +944,7 @@ static void print_header(void) 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 -- cgit v1.2.3 From c34e28835bc06ea9f76f440909f59a697910e9e8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" <Jason@zx2c4.com> Date: Thu, 12 May 2016 21:29:40 +0200 Subject: forms: action should not be empty Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> --- ui-shared.c | 2 +- ui-stats.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index 770b685..2c88b72 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -937,7 +937,7 @@ static void print_header(void) 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); diff --git a/ui-stats.c b/ui-stats.c index 8cd9178..7acd358 100644 --- a/ui-stats.c +++ b/ui-stats.c @@ -389,7 +389,7 @@ void cgit_show_stats(void) 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) { -- cgit v1.2.3 From 21bf30b043c5bcbf4bb92d7e79cb642ab9c2287d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" <Jason@zx2c4.com> Date: Thu, 12 May 2016 21:38:59 +0200 Subject: ui-diff: action='.' is not correct Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> --- ui-diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-diff.c b/ui-diff.c index 52ed942..edee793 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -340,7 +340,7 @@ void cgit_print_diff_ctrls(void) 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>"); -- cgit v1.2.3 From 41508c091186ece4cdc5d79c5ac0d2eda3d3edef Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Thu, 19 May 2016 23:12:03 +0200 Subject: git: update to v2.8.3 Update to git version v2.8.3, no changes required. Signed-off-by: Christian Hesse <mail@eworm.de> --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a7aa08b..23f5bc1 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = <openssl/sha.h> -GIT_VER = 2.8.2 +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 --git a/git b/git index 60115f5..0f8e831 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 60115f54bda3a127ed3cc8ffc6ab6c771cbceb1b +Subproject commit 0f8e831356d4f1a34baf46bb1a6b2d4c89ec9cb8 -- cgit v1.2.3 From a6572ce1762e0d571c3e96b5f4eff7c81015a1f2 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" <Jason@zx2c4.com> Date: Tue, 7 Jun 2016 14:31:09 +0200 Subject: Bump version. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 23f5bc1..30c1dfa 100644 --- a/Makefile +++ b/Makefile @@ -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) -- cgit v1.2.3 From d88ec849c4f7af41a8a41af1a4f79a2b4d41717a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" <Jason@zx2c4.com> Date: Wed, 24 Feb 2016 18:01:42 +0100 Subject: Hosted on HTTPS now --- README | 4 ++-- cgit.c | 2 +- filters/gentoo-ldap-authentication.lua | 2 +- ui-shared.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index 917d74a..7a6b4a4 100644 --- a/README +++ b/README @@ -92,8 +92,8 @@ the HTTP headers `Modified` and `Expires`. Online presence --------------- -* The cgit homepage is hosted by cgit at <http://git.zx2c4.com/cgit/about/> +* The cgit homepage is hosted by cgit at <https://git.zx2c4.com/cgit/about/> * Patches, bug reports, discussions and support should go to the cgit mailing list: <cgit@lists.zx2c4.com>. To sign up, visit - <http://lists.zx2c4.com/mailman/listinfo/cgit> + <https://lists.zx2c4.com/mailman/listinfo/cgit> diff --git a/cgit.c b/cgit.c index fc482be..ab3fadb 100644 --- a/cgit.c +++ b/cgit.c @@ -941,7 +941,7 @@ static void cgit_parse_args(int argc, const char **argv) for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--version")) { - printf("CGit %s | http://git.zx2c4.com/cgit/\n\nCompiled in features:\n", CGIT_VERSION); + printf("CGit %s | https://git.zx2c4.com/cgit/\n\nCompiled in features:\n", CGIT_VERSION); #ifdef NO_LUA printf("[-] "); #else diff --git a/filters/gentoo-ldap-authentication.lua b/filters/gentoo-ldap-authentication.lua index fce5632..6d8eb3e 100644 --- a/filters/gentoo-ldap-authentication.lua +++ b/filters/gentoo-ldap-authentication.lua @@ -4,7 +4,7 @@ -- luacrypto >= 0.3 -- <http://mkottman.github.io/luacrypto/> -- lualdap >= 1.2 --- <http://git.zx2c4.com/lualdap/about/> +-- <https://git.zx2c4.com/lualdap/about/> -- diff --git a/ui-shared.c b/ui-shared.c index 2c88b72..562fa0e 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -776,7 +776,7 @@ void cgit_print_docend(void) if (ctx.cfg.footer) html_include(ctx.cfg.footer); else { - htmlf("<div class='footer'>generated by <a href='http://git.zx2c4.com/cgit/about/'>cgit %s</a> at ", + htmlf("<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit %s</a> at ", cgit_version); html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_ISO8601))); html("</div>\n"); -- cgit v1.2.3 From 7d51120440346108aad74f007431ad65b307f6d7 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" <Jason@zx2c4.com> Date: Fri, 17 Jun 2016 12:27:10 +0200 Subject: md2html: use utf-8 and flush output buffer Otherwise we get the classic Python UTF-8 errors, and the text is all out of order. While we're at it, switch to python3 so we only have to support one set of oddball semantics. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Suggested-by: Daniel Campbell <dlcampbell@gmx.com> --- filters/html-converters/md2html | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html index c8ee7d9..ebf3856 100755 --- a/filters/html-converters/md2html +++ b/filters/html-converters/md2html @@ -1,7 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import markdown +import sys +import io from pygments.formatters import HtmlFormatter -print(''' +sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') +sys.stdout.write(''' <style> .markdown-body { font-size: 14px; @@ -279,11 +283,12 @@ print(''' border: none; } ''') -print(HtmlFormatter(style='pastie').get_style_defs('.highlight')) -print(''' +sys.stdout.write(HtmlFormatter(style='pastie').get_style_defs('.highlight')) +sys.stdout.write(''' </style> ''') -print("<div class='markdown-body'>") +sys.stdout.write("<div class='markdown-body'>") +sys.stdout.flush() # Note: you may want to run this through bleach for sanitization 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>") +sys.stdout.write("</div>") -- cgit v1.2.3 From 5062fbe7ec16c4f736bca9aab68dde101d6d6163 Mon Sep 17 00:00:00 2001 From: Kylie McClain <somasis@exherbo.org> Date: Tue, 7 Jun 2016 17:22:35 -0400 Subject: cgit.mk: Use $PKG_CONFIG PKG_CONFIG is a variable dictated by autoconf standards; it should be used if set. --- cgit.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cgit.mk b/cgit.mk index 1b50307..369f309 100644 --- a/cgit.mk +++ b/cgit.mk @@ -21,6 +21,8 @@ CGIT_CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' CGIT_CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' CGIT_CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' +PKG_CONFIG ?= pkg-config + ifdef NO_C99_FORMAT CFLAGS += -DNO_C99_FORMAT endif @@ -31,7 +33,7 @@ ifdef NO_LUA else ifeq ($(LUA_PKGCONFIG),) LUA_PKGCONFIG := $(shell for pc in luajit lua lua5.2 lua5.1; do \ - pkg-config --exists $$pc 2>/dev/null && echo $$pc && break; \ + $(PKG_CONFIG) --exists $$pc 2>/dev/null && echo $$pc && break; \ done) LUA_MODE := autodetected else @@ -39,8 +41,8 @@ else endif ifneq ($(LUA_PKGCONFIG),) LUA_MESSAGE := linking with $(LUA_MODE) $(LUA_PKGCONFIG) - LUA_LIBS := $(shell pkg-config --libs $(LUA_PKGCONFIG) 2>/dev/null) - LUA_CFLAGS := $(shell pkg-config --cflags $(LUA_PKGCONFIG) 2>/dev/null) + LUA_LIBS := $(shell $(PKG_CONFIG) --libs $(LUA_PKGCONFIG) 2>/dev/null) + LUA_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(LUA_PKGCONFIG) 2>/dev/null) CGIT_LIBS += $(LUA_LIBS) CGIT_CFLAGS += $(LUA_CFLAGS) else -- cgit v1.2.3 From 1e039ada8554c7e2fc65524827c61613a24256fb Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Mon, 13 Jun 2016 22:57:12 +0200 Subject: git: update to v2.9.0 Update to git version v2.9.0, no changes required. Signed-off-by: Christian Hesse <mail@eworm.de> --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 30c1dfa..c7a57f8 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = <openssl/sha.h> -GIT_VER = 2.8.3 +GIT_VER = 2.9.0 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index 0f8e831..05219a1 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 0f8e831356d4f1a34baf46bb1a6b2d4c89ec9cb8 +Subproject commit 05219a1276341e72d8082d76b7f5ed394b7437a4 -- cgit v1.2.3 From 9984e7ab49c59e49a0d7e62c3435e7133f7a53ec Mon Sep 17 00:00:00 2001 From: Lukas Fleischer <lfleischer@lfos.de> Date: Tue, 24 May 2016 18:15:18 +0200 Subject: Avoid ambiguities when prettifying snapshot names When composing snapshot file names for a tag with a prefix of the form v[0-9] (resp. V[0-9]), the leading "v" (resp. "V") is stripped. This leads to conflicts if a tag with the stripped name already exists or if there are tags only differing in the capitalization of the leading "v". Make sure we do not strip the "v" in these cases. Reported-by: Juuso Lapinlampi <wub@partyvan.eu> Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> --- ui-refs.c | 24 +++++++++--------------- ui-shared.c | 26 +++++++++++++++++++++----- ui-shared.h | 2 ++ 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/ui-refs.c b/ui-refs.c index 5b4530e..75f2789 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -93,34 +93,28 @@ static void print_tag_header(void) static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) { const struct cgit_snapshot_format* f; - struct strbuf filename = STRBUF_INIT; const char *basename; - int free_ref = 0; + struct strbuf filename = STRBUF_INIT; + size_t prefixlen; if (!ref || strlen(ref) < 1) return; basename = cgit_repobasename(repo->url); - if (!starts_with(ref, basename)) { - if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1])) - ref++; - if (isdigit(ref[0])) { - ref = fmtalloc("%s-%s", basename, ref); - free_ref = 1; - } - } - + if (starts_with(ref, basename)) + strbuf_addstr(&filename, ref); + else + cgit_compose_snapshot_prefix(&filename, basename, ref); + prefixlen = filename.len; for (f = cgit_snapshot_formats; f->suffix; f++) { if (!(repo->snapshots & f->bit)) continue; - strbuf_reset(&filename); - strbuf_addf(&filename, "%s%s", ref, f->suffix); + strbuf_setlen(&filename, prefixlen); + strbuf_addstr(&filename, f->suffix); cgit_snapshot_link(filename.buf, NULL, NULL, NULL, NULL, filename.buf); html("  "); } - if (free_ref) - free((char *)ref); strbuf_release(&filename); } diff --git a/ui-shared.c b/ui-shared.c index 562fa0e..b1a6c46 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1069,18 +1069,34 @@ void cgit_print_filemode(unsigned short mode) html_fileperm(mode); } +void cgit_compose_snapshot_prefix(struct strbuf *filename, const char *base, + const char *ref) +{ + unsigned char sha1[20]; + + /* + * Prettify snapshot names by stripping leading "v" or "V" if the tag + * name starts with {v,V}[0-9] and the prettify mapping is injective, + * i.e. each stripped tag can be inverted without ambiguities. + */ + if (get_sha1(fmt("refs/tags/%s", ref), sha1) == 0 && + (ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]) && + ((get_sha1(fmt("refs/tags/%s", ref + 1), sha1) == 0) + + (get_sha1(fmt("refs/tags/v%s", ref + 1), sha1) == 0) + + (get_sha1(fmt("refs/tags/V%s", ref + 1), sha1) == 0) == 1)) + ref++; + + strbuf_addf(filename, "%s-%s", base, ref); +} + void cgit_print_snapshot_links(const char *repo, const char *head, const char *hex, int snapshots) { const struct cgit_snapshot_format* f; struct strbuf filename = STRBUF_INIT; size_t prefixlen; - unsigned char sha1[20]; - if (get_sha1(fmt("refs/tags/%s", hex), sha1) == 0 && - (hex[0] == 'v' || hex[0] == 'V') && isdigit(hex[1])) - hex++; - strbuf_addf(&filename, "%s-%s", cgit_repobasename(repo), hex); + cgit_compose_snapshot_prefix(&filename, cgit_repobasename(repo), hex); prefixlen = filename.len; for (f = cgit_snapshot_formats; f->suffix; f++) { if (!(snapshots & f->bit)) diff --git a/ui-shared.h b/ui-shared.h index b457c97..87799f1 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -71,6 +71,8 @@ __attribute__((format (printf,3,4))) extern void cgit_print_error_page(int code, const char *msg, const char *fmt, ...); extern void cgit_print_pageheader(void); extern void cgit_print_filemode(unsigned short mode); +extern void cgit_compose_snapshot_prefix(struct strbuf *filename, + const char *base, const char *ref); extern void cgit_print_snapshot_links(const char *repo, const char *head, const char *hex, int snapshots); extern void cgit_add_hidden_formfields(int incl_head, int incl_search, -- cgit v1.2.3 From 4fb49864db51affddf37ab2a563b0eb4b33e155d Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Wed, 29 Jun 2016 09:37:57 +0200 Subject: ui-log: color line changes Signed-off-by: Christian Hesse <mail@eworm.de> --- cgit.css | 9 +++++++++ ui-log.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cgit.css b/cgit.css index 66c6d53..983eac5 100644 --- a/cgit.css +++ b/cgit.css @@ -590,6 +590,15 @@ div#cgit span.age-months { div#cgit span.age-years { color: #bbb; } + +div#cgit span.insertions { + color: #080; +} + +div#cgit span.deletions { + color: #800; +} + div#cgit div.footer { margin-top: 0.5em; text-align: center; diff --git a/ui-log.c b/ui-log.c index d6d94f6..c97b8e0 100644 --- a/ui-log.c +++ b/ui-log.c @@ -258,7 +258,8 @@ static void print_commit(struct commit *commit, struct rev_info *revs) if (ctx.repo->enable_log_filecount) htmlf("</td><td>%d", files); if (ctx.repo->enable_log_linecount) - htmlf("</td><td>-%d/+%d", rem_lines, add_lines); + htmlf("</td><td><span class='deletions'>-%d</span>/" + "<span class='insertions'>+%d</span>", rem_lines, add_lines); html("</td></tr>\n"); -- cgit v1.2.3 From c19d983ed7b86face56e41effea4fffcf9ad1e19 Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Wed, 29 Jun 2016 09:37:58 +0200 Subject: css: consistent use of empty lines Signed-off-by: Christian Hesse <mail@eworm.de> --- cgit.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cgit.css b/cgit.css index 983eac5..a4331f8 100644 --- a/cgit.css +++ b/cgit.css @@ -605,13 +605,16 @@ div#cgit div.footer { font-size: 80%; color: #ccc; } + div#cgit div.footer a { color: #ccc; text-decoration: none; } + div#cgit div.footer a:hover { text-decoration: underline; } + div#cgit a.branch-deco { color: #000; margin: 0px 0.5em; @@ -619,6 +622,7 @@ div#cgit a.branch-deco { background-color: #88ff88; border: solid 1px #007700; } + div#cgit a.tag-deco { color: #000; margin: 0px 0.5em; @@ -626,6 +630,7 @@ div#cgit a.tag-deco { background-color: #ffff88; border: solid 1px #777700; } + div#cgit a.remote-deco { color: #000; margin: 0px 0.5em; @@ -633,6 +638,7 @@ div#cgit a.remote-deco { background-color: #ccccff; border: solid 1px #000077; } + div#cgit a.deco { color: #000; margin: 0px 0.5em; -- cgit v1.2.3 From 590ba455d694deaf2ec206510cf7f047ac365a96 Mon Sep 17 00:00:00 2001 From: Eric Wong <normalperson@yhbt.net> Date: Wed, 6 Jul 2016 07:08:01 +0000 Subject: ui-shared: fix segfault when defbranch is NULL Not sure if there's a better fix for this. defbranch is NULL here on my setup when a crawler hit an invalid URL, causing strcmp to segfault. Signed-off-by: Eric Wong <normalperson@yhbt.net> --- ui-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index b1a6c46..e39d004 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -253,7 +253,7 @@ static char *repolink(const char *title, const char *class, const char *page, } delim = "&"; } - if (head && strcmp(head, ctx.repo->defbranch)) { + if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) { html(delim); html("h="); html_url_arg(head); -- cgit v1.2.3 From ccf79b3576d20a65db081725636529641a28d3c9 Mon Sep 17 00:00:00 2001 From: Peter Colberg <peter@colberg.org> Date: Fri, 10 Jun 2016 10:29:07 -0400 Subject: Fix spelling in man page Signed-off-by: Peter Colberg <peter@colberg.org> --- cgitrc.5.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 2e1912d..9fcf445 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -676,14 +676,14 @@ commit filter:: expected on standard output. email filter:: - This filter is given two parameters: the email address of the relevent + This filter is given two parameters: the email address of the relevant author and a string indicating the originating page. The filter will then receive the text string to format on standard input and is expected to write to standard output the formatted text to be included in the page. owner filter:: - This filter is given no arguments. The owner text is avilable on + This filter is given no arguments. The owner text is available on standard input and the filter is expected to write to standard output. The output is included in the Owner column. -- cgit v1.2.3 From 40fbefba0514b33988d453aea05aa2b956e98f84 Mon Sep 17 00:00:00 2001 From: Peter Colberg <peter@colberg.org> Date: Fri, 1 Jul 2016 22:00:37 -0400 Subject: Link with -ldl on GNU/kFreeBSD GNU/kFreeBSD uses the FreeBSD kernel with the GNU C library. Signed-off-by: Peter Colberg <peter@colberg.org> --- cgit.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cgit.mk b/cgit.mk index 369f309..8d4f5e0 100644 --- a/cgit.mk +++ b/cgit.mk @@ -53,8 +53,8 @@ endif endif -# Add -ldl to linker flags on non-BSD systems. -ifeq ($(findstring BSD,$(uname_S)),) +# Add -ldl to linker flags on systems that commonly use GNU libc. +ifneq (,$(filter $(uname_S),Linux GNU/kFreeBSD)) CGIT_LIBS += -ldl endif -- cgit v1.2.3