John Keeping [Mon, 8 Feb 2016 14:12:35 +0000 (14:12 +0000)]
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 <john@keeping.me.uk>
Jason A. Donenfeld [Mon, 8 Feb 2016 13:35:47 +0000 (14:35 +0100)]
ui-stats: if we're going to abuse void*, do it safely
Christian Hesse [Mon, 8 Feb 2016 08:06:47 +0000 (09:06 +0100)]
git: update to v2.7.1
Update to git version v2.7.1, no changes required.
Signed-off-by: Christian Hesse <mail@eworm.de>
John Keeping [Tue, 19 Jan 2016 19:33:08 +0000 (19:33 +0000)]
ui-shared: remove cgit_print_date()
There are no longer any users of this function.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:07 +0000 (19:33 +0000)]
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 <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:06 +0000 (19:33 +0000)]
ui-shared: use show_date for footer timestamp
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:05 +0000 (19:33 +0000)]
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 <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:04 +0000 (19:33 +0000)]
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 <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:03 +0000 (19:33 +0000)]
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 <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:02 +0000 (19:33 +0000)]
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 <john@keeping.me.uk>
John Keeping [Tue, 19 Jan 2016 19:33:01 +0000 (19:33 +0000)]
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 <john@keeping.me.uk>
Jason A. Donenfeld [Mon, 18 Jan 2016 14:56:45 +0000 (15:56 +0100)]
ui-tree: put reverse path in title
Jason A. Donenfeld [Mon, 18 Jan 2016 10:14:06 +0000 (11:14 +0100)]
syntax-highlighting: always use utf-8 to avoid ascii codec issues
John Keeping [Sat, 16 Jan 2016 11:03:07 +0000 (11:03 +0000)]
cache: don't check for match with no key
We call open_slot() from cache_ls() without a key since we simply want
to read the path out of the header. Should the file happen to contain
an empty key then we end up calling memcmp() with NULL and a non-zero
length. Fix this by assigning slot->match only if a key is set, which
is always will be in the code paths where we use slot->match.
Coverity-id: 13807
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Sat, 16 Jan 2016 11:03:06 +0000 (11:03 +0000)]
cache: use size_t for string lengths
Avoid integer truncation on 64-bit systems.
Coverity-id: 13864
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Sat, 16 Jan 2016 11:03:05 +0000 (11:03 +0000)]
ui-log: handle parse_commit() errors
If parse_commit() fails, none of the fields in the commit structure will
have been populated so we will dereference NULL when accessing
item->tree.
There isn't much we can do about the error at this point, but if we
return true then we'll try parsing the commit again from print_commit()
and we can report an error to the user at that point.
Coverity-id: 13801
Signed-off-by: John Keeping <john@keeping.me.uk>
Jason A. Donenfeld [Thu, 14 Jan 2016 14:43:54 +0000 (15:43 +0100)]
Bump version
Jason A. Donenfeld [Thu, 14 Jan 2016 13:53:28 +0000 (14:53 +0100)]
ui-plain: add enable-html-serving flag
Unrestricts plain/ to contents likely to be executed by browser.
Jason A. Donenfeld [Thu, 14 Jan 2016 13:43:43 +0000 (14:43 +0100)]
ui-blob: set CSP just in case
Jason A. Donenfeld [Thu, 14 Jan 2016 13:31:53 +0000 (14:31 +0100)]
ui-blob: always use generic mimetypes
Jason A. Donenfeld [Thu, 14 Jan 2016 13:31:13 +0000 (14:31 +0100)]
ui-blob: Do not accept mimetype from user
Jason A. Donenfeld [Thu, 14 Jan 2016 13:28:37 +0000 (14:28 +0100)]
ui-shared: prevent malicious filename from injecting headers
Jason A. Donenfeld [Thu, 14 Jan 2016 13:13:39 +0000 (14:13 +0100)]
ui-shared: Avoid new line injection into redirect header
Peter Colberg [Wed, 13 Jan 2016 22:25:07 +0000 (17:25 -0500)]
Fix missing prototype declarations
Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg [Tue, 8 Dec 2015 17:53:09 +0000 (12:53 -0500)]
ui-repolist: return HTTP 404 if no repositories found
Return HTTP status code 404 Not found when querying a non-existent
repository, which signals to search engines that a repository no
longer exists. Further, some webservers such as nginx permit
logging requests to different files depending on the HTTP code.
Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg [Tue, 8 Dec 2015 17:53:08 +0000 (12:53 -0500)]
ui-repolist: extract repo visibility criteria to separate function
Signed-off-by: Peter Colberg <peter@colberg.org>
Lukas Fleischer [Sun, 13 Dec 2015 00:27:13 +0000 (01:27 +0100)]
Fix segmentation fault in hc()
The ctx.qry.page variable might be unset at this point, e.g. when an
invalid command is passed and cgit_print_pageheader() is called to show
an error message.
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Christian Hesse [Tue, 5 Jan 2016 06:38:53 +0000 (07:38 +0100)]
git: update to v2.7.0
Update to git version v2.7.0.
* Upstream commit
ed1c9977cb1b63e4270ad8bdf967a2d02580aa08 (Remove
get_object_hash.) changed API:
Convert all instances of get_object_hash to use an appropriate
reference to the hash member of the oid member of struct object.
This provides no functional change, as it is essentially a macro
substitution.
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Tue, 12 Jan 2016 23:45:03 +0000 (00:45 +0100)]
ui-repolist: initialize char *buf to NULL
readfile() can fail if the agefile is not readable. Make sure free()
does not free an ininitialized string.
Signed-off-by: Christian Hesse <mail@eworm.de>
Jason A. Donenfeld [Tue, 24 Nov 2015 10:28:00 +0000 (11:28 +0100)]
filter: avoid integer overflow in authenticate_post
ctx.env.content_length is an unsigned int, coming from the
CONTENT_LENGTH environment variable, which is parsed by strtoul. The
HTTP/1.1 spec says that "any Content-Length greater than or equal to
zero is a valid value." By storing this into an int, we potentially
overflow it, resulting in the following bounding check failing, leading
to a buffer overflow.
Reported-by: Erik Cabetas <Erik@cabetas.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld [Thu, 12 Nov 2015 03:44:32 +0000 (04:44 +0100)]
about-formatting.sh: comment text out of date
Christian Hesse [Mon, 12 Oct 2015 16:23:56 +0000 (18:23 +0200)]
filters: port syntax-highlighting.py to python 3.x
Signed-off-by: Christian Hesse <mail@eworm.de>
Jason A. Donenfeld [Mon, 12 Oct 2015 16:33:21 +0000 (18:33 +0200)]
md2html: the default of stdin works fine
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld [Mon, 12 Oct 2015 14:47:47 +0000 (16:47 +0200)]
filters: misc cleanups
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld [Mon, 12 Oct 2015 14:42:48 +0000 (16:42 +0200)]
md2html: use pure python
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Christian Hesse [Sat, 10 Oct 2015 14:56:28 +0000 (16:56 +0200)]
cache: fix resource leak: close file handle before return
Coverity-id: 13910
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Sat, 10 Oct 2015 14:56:27 +0000 (16:56 +0200)]
ui-atom: fix resource leak: free allocation from cgit_pageurl
Coverity-id: 13945
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Sat, 10 Oct 2015 14:56:26 +0000 (16:56 +0200)]
ui-atom: fix resource leak: free before return
Coverity-id: 13946
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Sat, 10 Oct 2015 14:56:25 +0000 (16:56 +0200)]
ui-atom: fix resource leak: free allocation from cgit_repourl
Coverity-id: 13947
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Sat, 10 Oct 2015 14:56:23 +0000 (16:56 +0200)]
ui-blob: fix resource leak: free before return
Coverity-id: 13944
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Sat, 10 Oct 2015 14:56:24 +0000 (16:56 +0200)]
ui-blob: fix resource leak: free before return
Coverity-id: 13943
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 12:55:50 +0000 (14:55 +0200)]
ui-plain: fix resource leak: free before assigning NULL
Coverity-id: 13939
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 12:55:49 +0000 (14:55 +0200)]
ui-plain: fix resource leak: free before return
Coverity-id: 13940
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 12:55:48 +0000 (14:55 +0200)]
ui-repolist: fix resource leak: free allocation from cgit_currenturl
Coverity-id: 13930
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 12:55:47 +0000 (14:55 +0200)]
ui-repolist: fix resource leak: free before return
Coverity-id: 13931
Signed-off-by: Christian Hesse <mail@eworm.de>
Jason A. Donenfeld [Fri, 9 Oct 2015 13:13:35 +0000 (15:13 +0200)]
filters: Simplify converters
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Christian Hesse [Fri, 9 Oct 2015 11:15:51 +0000 (13:15 +0200)]
ui-shared: fix resource leak: free allocation from cgit_hosturl
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:50 +0000 (13:15 +0200)]
ui-shared: return value of cgit_hosturl is not const
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:49 +0000 (13:15 +0200)]
cmd: fix resource leak: free allocation from cgit_currenturl and fmtalloc
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:48 +0000 (13:15 +0200)]
ui-shared: fix resource leak: free allocation from cgit_currenturl
Coverity-id: 13927
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:47 +0000 (13:15 +0200)]
ui-shared: return value of cgit_currenturl is not const
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:46 +0000 (13:15 +0200)]
ui-shared: fix resource leak: free allocation from cgit_fileurl
Coverity-id: 13918
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:45 +0000 (13:15 +0200)]
ui-ssdiff: fix resource leak: free allocation from cgit_fileurl
Coverity-id: 13929
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 9 Oct 2015 11:15:44 +0000 (13:15 +0200)]
ui-tree: fix resource leak: free before return
Coverity-id: 13938
Signed-off-by: Christian Hesse <mail@eworm.de>
Jason A. Donenfeld [Fri, 9 Oct 2015 09:01:04 +0000 (11:01 +0200)]
Avoid use of non-reentrant functions
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
John Keeping [Sat, 5 Sep 2015 13:32:50 +0000 (14:32 +0100)]
Makefile: fix MAKEFLAGS tests with multiple flags
findstring is defined as $(findstring FIND,IN) so if multiple flags are
set these tests do the wrong thing unless $(MAKEFLAGS) is the second
argument.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 8 Oct 2015 22:23:59 +0000 (23:23 +0100)]
ui-refs: remove useless null check
There is no way that "tag" can be null here.
Coverity-id: 13950
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 8 Oct 2015 22:23:58 +0000 (23:23 +0100)]
ui-blob: remove useless null check
We have already called strlen() on "path" by the time we get here, so we
know it can't be null.
Coverity-id: 13954
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 8 Oct 2015 22:23:57 +0000 (23:23 +0100)]
scan-tree: remove useless strdup()
parse_configfile() takes a "const char *" and doesn't hold any
references to it after it returns; there is no reason to pass it a
duplicate.
Coverity-id: 13941
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 8 Oct 2015 22:23:56 +0000 (23:23 +0100)]
cgit.c: remove useless null check
Everywhere else in this function we do not check whether the value is
null and parse_configfile() never passes a null value to this callback.
Coverity-id: 13846
Signed-off-by: John Keeping <john@keeping.me.uk>
Christian Hesse [Tue, 6 Oct 2015 05:36:40 +0000 (07:36 +0200)]
git: update to v2.6.1
Update to git version v2.6.1, no changes required.
Signed-off-by: Christian Hesse <mail@eworm.de>
Jason A. Donenfeld [Mon, 17 Aug 2015 12:35:20 +0000 (14:35 +0200)]
mime: rewrite detection function
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Christian Hesse [Sun, 16 Aug 2015 12:53:53 +0000 (14:53 +0200)]
ui-summary: send images plain for about page
The about page used to display just fine, but images were broken: The
binary image data was embedded in html code.
Use cgit_print_plain() to send images in plain mode and make them
available on about page.
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Sun, 16 Aug 2015 12:53:52 +0000 (14:53 +0200)]
refactor get_mimetype_from_file() to get_mimetype_for_filename()
* handle mimetype within a single function
* return allocated memory on success
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse [Fri, 14 Aug 2015 14:50:56 +0000 (16:50 +0200)]
move get_mimetype_from_file() to shared
Signed-off-by: Christian Hesse <mail@eworm.de>
John Keeping [Fri, 14 Aug 2015 14:20:23 +0000 (15:20 +0100)]
cmd: fix command definition
The previous commit removed the "pre" field from "struct cgit_cmd" but
forgot to update this macro.
Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
Jason A. Donenfeld [Fri, 14 Aug 2015 13:54:32 +0000 (15:54 +0200)]
cmd: no need for pre function hook now
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
John Keeping [Fri, 14 Aug 2015 11:47:22 +0000 (12:47 +0100)]
ui-shared: cache errors for "dynamic TTL"
Most errors we generate are (potentially) transient, such as
non-existent object IDs so we don't want them to be cached forever.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:21 +0000 (12:47 +0100)]
cmd: remove "want_layout" field
No commands use this any more.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:20 +0000 (12:47 +0100)]
tree: move layout into page function
This also allows us to return proper HTTP error codes when the requested
tree is not found and display an error message in one case (invalid path
inside valid commit) where we previously just displayed an empty page.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:19 +0000 (12:47 +0100)]
tag: move layout into page function
This also allows us to return proper HTTP error codes when something
goes wrong.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:18 +0000 (12:47 +0100)]
summary: move layout into page function
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:17 +0000 (12:47 +0100)]
stats: move layout into page function
This also allows us to return proper HTTP error codes for invalid
requests.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:16 +0000 (12:47 +0100)]
refs: move layout to page function
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:15 +0000 (12:47 +0100)]
log: move layout into page function
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:14 +0000 (12:47 +0100)]
diff: move layout to page function
The existing "show_ctrls" flag is used to control whether we are running
in an existing page or control the page ourselves.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:13 +0000 (12:47 +0100)]
commit: move layout into page function
This allows us to return a proper HTTP status code when an object is not
found by switching from cgit_print_error() to cgit_print_error_page().
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:12 +0000 (12:47 +0100)]
about: move layout into page functions
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:11 +0000 (12:47 +0100)]
ui-shared: add cgit_print_layout_{start,end}()
These will avoid needing to call three functions to start page layout in
subsequent patches when we move the layout setup into each individual
page.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:10 +0000 (12:47 +0100)]
html: remove html_status()
This is now unused.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:09 +0000 (12:47 +0100)]
snapshot: don't reimplement cgit_print_error_page()
cgit_print_error_page() has the advantage that it sets a suitable HTTP
status code for the response. Note that setting "mimetype" is redundant
here since it cannot have changed since being initialized in
cgit.c::prepare_context(), so we do not need to worry that
cgit_print_error_page() does not set it.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:08 +0000 (12:47 +0100)]
snapshot: use cgit_print_error_page() for HTTP status codes
This is a bugfix as well as an improvement to the HTTP status code
handling since previously we would not print HTTP headers on any of
these code paths.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:07 +0000 (12:47 +0100)]
patch: use cgit_print_error_page() for HTTP status codes
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:06 +0000 (12:47 +0100)]
blob: use cgit_print_error_page() to add HTTP headers
This is a bugfix as well as an improvement to the HTTP status code
handling since previously we would not print HTTP headers on any of
these code paths.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:05 +0000 (12:47 +0100)]
snapshot: use cgit_print_error_page() instead of html_status()
This provides a formatted error response rather than a simple HTTP
error.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:04 +0000 (12:47 +0100)]
plain: use cgit_print_error_page() instead of html_status()
This provides a formatted error response rather than a simple HTTP
error.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:03 +0000 (12:47 +0100)]
clone: use cgit_print_error_page() instead of html_status()
This provides a formatted error response rather than a simple HTTP
error.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:02 +0000 (12:47 +0100)]
cgit: use cgit_print_error_page() where appropriate
These are more-or-less one-to-one translations but in the final hunk we
gain an HTTP error code where we used to send "200 OK", which is an
improvement.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Fri, 14 Aug 2015 11:47:01 +0000 (12:47 +0100)]
ui-shared: add cgit_print_error_page() function
This will allow us to generate error responses with the correct HTTP
response code without needing all of the layout boilerplate.
Signed-off-by: John Keeping <john@keeping.me.uk>
Christian Hesse [Thu, 13 Aug 2015 22:02:50 +0000 (00:02 +0200)]
ui-patch: make sure to send http headers
Requesting a text/plain patch with bad commit id made cgit send text
without proper http headers. This results in "500 Internal Server Error"
with "Premature end of script headers" in server logs.
So print http headers before error message and return.
Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 14:54:37 +0000 (15:54 +0100)]
Makefile: make "git/config.mak.uname" inclusion optional
If we haven't got a "git" directory, it should still be possible to run
"make get-git", so we cannot include this file unconditionally.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:24:34 +0000 (12:24 +0100)]
ui-shared: show full date in tooltip if longer ago than max_relative
Commit
caed6cb (ui-shared: show absolute time in tooltip for relative
dates, 2014-12-20) added a toolip when we show a relative time.
However, in some cases we show a short date (that is, the date but not
the time) if an event was sufficiently far in the past and that commit
did not update that case to add the same tooltip.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:24:33 +0000 (12:24 +0100)]
ui-shared: use common function in print_rel_date()
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:24:32 +0000 (12:24 +0100)]
ui-shared: extract date formatting to a function
This will allow this code to be common with print_rel_date.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:14:20 +0000 (12:14 +0100)]
filter: don't use dlsym unnecessarily
We only need to hook write() if Lua filter's are in use. If support has
been disabled, remove the dependency on dlsym().
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:14:19 +0000 (12:14 +0100)]
ui-tree: use "sane" isgraph()
Git's git-compat-util.h defines a "sane ctype" that does not use locale
information and works with signed chars, but it does not include
isgraph() so we have included ctype.h ourselves.
However, this means we have to include a system header before
git-compat-util.h which may lead to the system defining some macros
(e.g. _FILE_OFFSET_BITS on Solaris) before git-compat-util.h redefines
them with a different value. We cannot include ctype.h after
git-compat-util.h because we have defined many of its functions as
macros which causes a stream of compilation errors.
Defining our own "sane" isgraph() using Git's sane isprint() and
isspace() avoids all of these problems.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:14:18 +0000 (12:14 +0100)]
cgit.h: move stdbool.h from ui-shared.h
Follow the Git policy of including system headers in only one place.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:14:17 +0000 (12:14 +0100)]
cache.c: fix header order
git-compat-util.h may define values that affect how system headers are
interpreted, so move sys/sendfile.h after cgit.h (which includes
git-compat-util.h).
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:14:16 +0000 (12:14 +0100)]
configfile.c: don't include system headers directly
git-compat-util.h may define various values that affect the
interpretation of system headers. In most places we include cgit.h
first, which pulls in git-compat-util.h, but this file does not depend
on anything else in CGit, so use git-compat-util.h directly.
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping [Thu, 13 Aug 2015 11:14:15 +0000 (12:14 +0100)]
Remove redundant includes
These are all included in git-compat-util.h (when necessary), which we
include in cgit.h.
Signed-off-by: John Keeping <john@keeping.me.uk>