]> granicus.if.org Git - cgit/log
cgit
9 years agosummary: move layout into page function
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>
9 years agostats: move layout into page function
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>
9 years agorefs: move layout to page function
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>
9 years agolog: move layout into page function
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>
9 years agodiff: move layout to page function
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>
9 years agocommit: move layout into page function
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>
9 years agoabout: move layout into page functions
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>
9 years agoui-shared: add cgit_print_layout_{start,end}()
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>
9 years agohtml: remove html_status()
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>
9 years agosnapshot: don't reimplement cgit_print_error_page()
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>
9 years agosnapshot: use cgit_print_error_page() for HTTP status codes
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>
9 years agopatch: use cgit_print_error_page() for HTTP status codes
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>
9 years agoblob: use cgit_print_error_page() to add HTTP headers
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>
9 years agosnapshot: use cgit_print_error_page() instead of html_status()
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>
9 years agoplain: use cgit_print_error_page() instead of html_status()
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>
9 years agoclone: use cgit_print_error_page() instead of html_status()
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>
9 years agocgit: use cgit_print_error_page() where appropriate
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>
9 years agoui-shared: add cgit_print_error_page() function
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>
9 years agoui-patch: make sure to send http headers
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>
9 years agoMakefile: make "git/config.mak.uname" inclusion optional
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>
9 years agoui-shared: show full date in tooltip if longer ago than max_relative
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>
9 years agoui-shared: use common function in print_rel_date()
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>
9 years agoui-shared: extract date formatting to a function
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>
9 years agofilter: don't use dlsym unnecessarily
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>
9 years agoui-tree: use "sane" isgraph()
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>
9 years agocgit.h: move stdbool.h from ui-shared.h
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>
9 years agocache.c: fix header order
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>
9 years agoconfigfile.c: don't include system headers directly
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>
9 years agoRemove redundant includes
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>
9 years agoMakefile: include Git's config.mak.uname
John Keeping [Thu, 13 Aug 2015 11:14:14 +0000 (12:14 +0100)]
Makefile: include Git's config.mak.uname

This pulls in the correct value of $(INSTALL) on a wide variety of
systems.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agotests: allow shell to be overridden
John Keeping [Thu, 13 Aug 2015 11:14:13 +0000 (12:14 +0100)]
tests: allow shell to be overridden

On some systems (e.g. Solaris), /bin/sh is not a POSIX shell.  Git
already provides suitable overrides in its config.mak.uname file and we
provide cgit.conf to allow the user to further change this.

The code for this is taken from Git's t/Makefile, meaning that we now
invoke the tests in the same way that Git does.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoredirect: cleanliness
Jason A. Donenfeld [Thu, 13 Aug 2015 09:38:56 +0000 (11:38 +0200)]
redirect: cleanliness

9 years agoredirect: be more careful for different cgi setups
Jason A. Donenfeld [Thu, 13 Aug 2015 09:38:27 +0000 (11:38 +0200)]
redirect: be more careful for different cgi setups

9 years agoui-log: fix double counting
John Keeping [Wed, 12 Aug 2015 15:41:34 +0000 (16:41 +0100)]
ui-log: fix double counting

This crept in while rebasing the previous commit onto an updated
upstream.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agolog: allow users to follow a file
John Keeping [Wed, 12 Aug 2015 14:55:28 +0000 (15:55 +0100)]
log: allow users to follow a file

Teach the "log" UI to behave in the same way as "git log --follow", when
given a suitable instruction by the user.  The default behaviour remains
to show the log without following renames, but the follow behaviour can
be activated by following a link in the page header.

Follow is not the default because outputting merges in follow mode is
tricky ("git log --follow" will not show merges).  We also disable the
graph in follow mode because the commit graph is not simplified so we
end up with frequent gaps in the graph and many lines that do not
connect with any commits we're actually showing.

We also teach the "diff" and "commit" UIs to respect the follow flag on
URLs, causing the single-file version of these UIs to detect renames.
This feature is needed only for commits that rename the path we're
interested in.

For commits before the file has been renamed (i.e. that appear later in
the log list) we change the file path in the links from the log to point
to the old name; this means that links to commits always limit by the
path known to that commit.  If we didn't do this we would need to walk
down the log diff'ing every commit whenever we want to show a commit.
The drawback is that the "Log" link in the top bar of such a page links
to the log limited by the old name, so it will only show pre-rename
commits.  I consider this a reasonable trade-off since the "Back" button
still works and the log matches the path displayed in the top bar.

Since following renames requires running diff on every commit we
consider, I've added a knob to the configuration file to globally
enable/disable this feature.  Note that we may consider a large number
of commits the revision walking machinery no longer performs any path
limitation so we have to examine every commit until we find a page full
of commits that affect the target path or something related to it.

Suggested-by: René Neumann <necoro@necoro.eu>
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoshared: make cgit_diff_tree_cb public
John Keeping [Wed, 12 Aug 2015 14:34:48 +0000 (15:34 +0100)]
shared: make cgit_diff_tree_cb public

This will allow us to use this nice wrapper function elsewhere, avoiding
dealing with the diff queue when we only need to inspect a filepair.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agot0110: Chain together using &&
Jason A. Donenfeld [Wed, 12 Aug 2015 13:15:56 +0000 (15:15 +0200)]
t0110: Chain together using &&

9 years agoabout: always ensure page has a trailing slash
Jason A. Donenfeld [Wed, 12 Aug 2015 12:50:09 +0000 (14:50 +0200)]
about: always ensure page has a trailing slash

Otherwise we can't easily embed links to other /about/ pages.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agofilters: apply HTML escaping
Lazaros Koromilas [Wed, 15 Jul 2015 12:53:12 +0000 (15:53 +0300)]
filters: apply HTML escaping

http://www.w3.org/International/questions/qa-escapes#use

9 years agogit: update to v2.5.0
Christian Hesse [Tue, 28 Jul 2015 08:42:01 +0000 (10:42 +0200)]
git: update to v2.5.0

Update to git version v2.5.0.

* Upstream commit 5455ee0573a22bb793a7083d593ae1ace909cd4c (Merge branch
  'bc/object-id') changed API:

  for_each_ref() callback functions were taught to name the objects
  not with "unsigned char sha1[20]" but with "struct object_id".

* Upstream commit dcf692625ac569fefbe52269061230f4fde10e47 (path.c: make
  get_pathname() call sites return const char *)

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoFix processing of repo.hide and repo.ignore
Daniel Reichelt [Mon, 10 Aug 2015 07:45:48 +0000 (09:45 +0200)]
Fix processing of repo.hide and repo.ignore

If the global option enable-filter-overrides is set to 1 the repo-specific
options repo.hide and repo.ignore never got processed.

Signed-off-by: Daniel Reichelt <hacking@nachtgeist.net>
Reviewed-by: John Keeping <john@keeping.me.uk>
9 years agocontrib/hooks: add sample post-receive hook using agefile
John Keeping [Tue, 23 Dec 2014 14:40:44 +0000 (14:40 +0000)]
contrib/hooks: add sample post-receive hook using agefile

One of the most frequent questions on the mailing list relates to the
idle time in the repository list.  The answer to this is to use the
"agefile" feature to calculate the time of the last change whenever the
repository receives changes.

Add a sample post-receive hook in a new "contrib" directory so that we
can just point people at the repository in the future.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agogit: update to v2.4.1
Christian Hesse [Thu, 14 May 2015 11:47:28 +0000 (13:47 +0200)]
git: update to v2.4.1

Update to git version v2.4.1, no changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoui-shared: allow remote refs in branch switcher
Christian Hesse [Wed, 18 Mar 2015 17:08:48 +0000 (18:08 +0100)]
ui-shared: allow remote refs in branch switcher

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agogit: update to v2.3.3
Christian Hesse [Sat, 14 Mar 2015 16:21:42 +0000 (17:21 +0100)]
git: update to v2.3.3

Update to git version v2.3.3, no changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoBump version v0.11.2
Jason A. Donenfeld [Fri, 13 Mar 2015 15:22:11 +0000 (16:22 +0100)]
Bump version

9 years agoRemove no-op link from submodule entries
Lukas Fleischer [Thu, 5 Mar 2015 19:41:45 +0000 (20:41 +0100)]
Remove no-op link from submodule entries

Instead of linking to the current page ("href='#'"), do not add a link
to a submodule entry at all if the module-link setting is not used.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agofilters: Add sample gentoo script
Jason A. Donenfeld [Tue, 10 Mar 2015 01:21:31 +0000 (02:21 +0100)]
filters: Add sample gentoo script

9 years agocgit: remember to set up env vars before empty clone path
Jason A. Donenfeld [Sun, 8 Mar 2015 12:08:04 +0000 (13:08 +0100)]
cgit: remember to set up env vars before empty clone path

9 years agoui-shared: currenturl should take into account leading slash
Jason A. Donenfeld [Sun, 8 Mar 2015 11:34:07 +0000 (12:34 +0100)]
ui-shared: currenturl should take into account leading slash

9 years agohtml: avoid using a plain integer as a NULL pointer
John Keeping [Sun, 8 Mar 2015 16:32:27 +0000 (16:32 +0000)]
html: avoid using a plain integer as a NULL pointer

Sparse complains about this table because we use the integer zero as the
NULL pointer.  Use this as an opportunity to reformat the table so that
it always contains 8 elements per row, making it easier to see which
values are being set and which are not.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agocache: don't use an integer as a NULL pointer
John Keeping [Sun, 8 Mar 2015 16:32:26 +0000 (16:32 +0000)]
cache: don't use an integer as a NULL pointer

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-shared: don't use an integer as a NULL pointer
John Keeping [Sun, 8 Mar 2015 16:32:25 +0000 (16:32 +0000)]
ui-shared: don't use an integer as a NULL pointer

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-shared: avoid initializing static variable to zero
John Keeping [Sun, 8 Mar 2015 16:32:24 +0000 (16:32 +0000)]
ui-shared: avoid initializing static variable to zero

Sparse complains that we are using a plain integer as a NULL pointer
here, but in fact we do not have to specify a value for this variable at
all since it has static storage duration and thus will be initialized to
NULL by the compiler.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-stats: make cgit_period definitions 'static const'
John Keeping [Sun, 8 Mar 2015 16:32:23 +0000 (16:32 +0000)]
ui-stats: make cgit_period definitions 'static const'

These definitions should not be modified (and never are) so we can move
them to .rodata.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-shared: make cgit_doctype 'static'
John Keeping [Sun, 8 Mar 2015 16:32:22 +0000 (16:32 +0000)]
ui-shared: make cgit_doctype 'static'

This is not used outside this file and is not declared.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-repolist: make sortcolumn definitions 'static const'
John Keeping [Sun, 8 Mar 2015 16:32:21 +0000 (16:32 +0000)]
ui-repolist: make sortcolumn definitions 'static const'

These are not used outside this file and are not declared; they are also
never modified.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-log: make some variables 'static'
John Keeping [Sun, 8 Mar 2015 16:32:20 +0000 (16:32 +0000)]
ui-log: make some variables 'static'

These are not used outside this file and are not declared.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoshared: make some variables 'static'
John Keeping [Sun, 8 Mar 2015 16:32:19 +0000 (16:32 +0000)]
shared: make some variables 'static'

These are not used outside this file and are not declared.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoscan-tree: make some variables 'static'
John Keeping [Sun, 8 Mar 2015 16:32:18 +0000 (16:32 +0000)]
scan-tree: make some variables 'static'

These are not used outside this file and are not declared.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoAvoid signed bitfields
John Keeping [Sun, 8 Mar 2015 16:32:17 +0000 (16:32 +0000)]
Avoid signed bitfields

Bitfields are only defined for unsigned types.

Detected by sparse.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoAvoid non-ANSI function declarations
John Keeping [Sun, 8 Mar 2015 16:32:16 +0000 (16:32 +0000)]
Avoid non-ANSI function declarations

Sparse says things like:

warning: non-ANSI function declaration of function 'calc_ttl'

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoMakefile: add a target to run CGit through sparse
John Keeping [Sun, 8 Mar 2015 16:32:15 +0000 (16:32 +0000)]
Makefile: add a target to run CGit through sparse

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agogit: update to v2.3.2
Christian Hesse [Sat, 7 Mar 2015 11:44:39 +0000 (12:44 +0100)]
git: update to v2.3.2

Update to git version v2.3.2, no changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoBump version v0.11.1
Jason A. Donenfeld [Thu, 5 Mar 2015 14:58:28 +0000 (15:58 +0100)]
Bump version

9 years agoDrop return value from parse_user()
Lukas Fleischer [Thu, 5 Mar 2015 11:58:12 +0000 (12:58 +0100)]
Drop return value from parse_user()

In commit 936295c (Simplify commit and tag parsing, 2015-03-03), the
commit and tag parsing code was refactored. This broke tag messages in
ui-tag since the line after the tagger header was erroneously skipped.
Rework parse_user() and skip the line manually outside parse_user().

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agoRemove leading newline characters from tag messages
Lukas Fleischer [Thu, 5 Mar 2015 11:58:11 +0000 (12:58 +0100)]
Remove leading newline characters from tag messages

Fixes a regression introduced in commit 936295c (Simplify commit and tag
parsing, 2015-03-03).

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agosimple-authentication.lua: tie secure cookies to field names
Jason A. Donenfeld [Thu, 5 Mar 2015 14:45:25 +0000 (15:45 +0100)]
simple-authentication.lua: tie secure cookies to field names

9 years agocgit: show clone URLs for empty repo
Jason A. Donenfeld [Thu, 5 Mar 2015 01:18:42 +0000 (02:18 +0100)]
cgit: show clone URLs for empty repo

9 years agocache: use F_SETLK to avoid stale lock files
John Keeping [Tue, 3 Mar 2015 19:22:31 +0000 (19:22 +0000)]
cache: use F_SETLK to avoid stale lock files

If CGit is killed while it holds a lock on a cache slot (for example
because it is taking too long to generate a page), the lock file will be
left in place.  This prevents any future attempt to use the same slot
since it will fail to exclusively create the lock file.

Since CGit is the only program that should be manipulating lock files,
we can use advisory locking to detect whether another process is
actually using the lock file or if it is now stale.

I have confirmed that this works on Linux by setting a short TTL in a
custom cgitrc and running the following with CGit patched to print a
message to stderr if the fcntl(2) fails:

$ export CGIT_CONFIG=$PWD/cgitrc
$ export QUERY_STRING=url=cgit/tree/ui-shared.c
$ ./cgit |
grep -v -e '^<div class=.footer.>' \
-e '^Last-Modified: ' \
-e ^'Expires: ' >expect
$ seq 50000 | dd bs=8192 |
parallel -j200 "diff -u expect <(./cgit |
grep -v -e '^<div class=.footer.>' \
-e '^Last-Modified: ' \
-e ^'Expires: ') || echo BAD"

This printed the fail message several times without ever printing "BAD".

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoMake root handling sane again.
Jason A. Donenfeld [Tue, 3 Mar 2015 16:23:40 +0000 (17:23 +0100)]
Make root handling sane again.

9 years agoui-shared: Add current url helper function.
Jason A. Donenfeld [Tue, 3 Mar 2015 16:18:42 +0000 (17:18 +0100)]
ui-shared: Add current url helper function.

9 years agoui-shared: keep filter repolist page in pagination
Jason A. Donenfeld [Tue, 3 Mar 2015 16:13:52 +0000 (17:13 +0100)]
ui-shared: keep filter repolist page in pagination

9 years agoui-repolist: use ctx.qry.url instead of rooturl, in case we're filtering
Jason A. Donenfeld [Tue, 3 Mar 2015 16:06:48 +0000 (17:06 +0100)]
ui-repolist: use ctx.qry.url instead of rooturl, in case we're filtering

9 years agoui-repolist: use correct owner query link
Jason A. Donenfeld [Tue, 3 Mar 2015 15:53:11 +0000 (16:53 +0100)]
ui-repolist: use correct owner query link

9 years agoSimplify commit and tag parsing
Lukas Fleischer [Tue, 3 Mar 2015 12:00:07 +0000 (13:00 +0100)]
Simplify commit and tag parsing

* Use skip_prefix to avoid magic numbers in the code.
* Use xcalloc() instead of xmalloc(), followed by manual initialization.
* Split out line splitting.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agogit: update to v2.3.1
Christian Hesse [Wed, 25 Feb 2015 08:14:13 +0000 (09:14 +0100)]
git: update to v2.3.1

Update to git version v2.3.1, no changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoBump verison v0.11.0
Jason A. Donenfeld [Sun, 15 Feb 2015 21:12:12 +0000 (22:12 +0100)]
Bump verison

9 years agoshrink cgit.png file size
Christian Hesse [Wed, 11 Feb 2015 08:12:44 +0000 (09:12 +0100)]
shrink cgit.png file size

Ran optipng against cgit.png, which shrank file size by more than eight
percent. The image (including protocol overhead) should fit into a
single network packet now.

Optipng optimizes filters and compression. The actual pixel results are
not altered.

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoui-clone.c: Fix off-by-one error in pack path
Jason A. Donenfeld [Mon, 9 Feb 2015 11:27:44 +0000 (12:27 +0100)]
ui-clone.c: Fix off-by-one error in pack path

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agoui-clone.c: Fix path check
Lukas Fleischer [Mon, 9 Feb 2015 06:25:00 +0000 (07:25 +0100)]
ui-clone.c: Fix path check

The starts_with() check was broken in two ways: For one thing, the
parameters were passed in the wrong order, for another thing,
starts_with() returns 1 if the string starts with the prefix (not 0).

Note that this bug existed since commit 02a545e (Add support for cloning
over http, 2008-08-06) but only pops in in corner cases.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agogit: update for v2.3.0
Christian Hesse [Sat, 7 Feb 2015 13:18:28 +0000 (14:18 +0100)]
git: update for v2.3.0

* sort_string_list(): rename to string_list_sort() (upstream commit
  3383e199)
* update read_tree_recursive callback to pass strbuf as base (upstream
  commit 6a0b0b6d)

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoui-shared.c: Refactor add_clone_urls()
Lukas Fleischer [Thu, 5 Feb 2015 09:11:42 +0000 (10:11 +0100)]
ui-shared.c: Refactor add_clone_urls()

Make use of strbuf_split_str() and strbuf lists to split clone URLs.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agoAdd repo.hide and repo.ignore
Lukas Fleischer [Thu, 29 Jan 2015 11:52:49 +0000 (12:52 +0100)]
Add repo.hide and repo.ignore

These options can be used to hide a repository from the index or
completely ignore a repository, respectively. They are particularly
useful when used in combination with scan-path.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agoAdd Etags for snapshots
Janus [Sat, 17 Jan 2015 13:54:31 +0000 (14:54 +0100)]
Add Etags for snapshots

9 years agotag: reference with "h" instead of "id"
John Keeping [Thu, 15 Jan 2015 22:18:14 +0000 (22:18 +0000)]
tag: reference with "h" instead of "id"

When clicking on "log" from a tag we end up showing the log of whatever
branch we used to reach the tag.  If the tag doesn't point onto a branch
then the tagged commit won't appear in this output.

By linking to tags with the head parameter instead of the "id" parameter
the log link will show the log of the tag.  This is clearly desirable
when the tag has been reached from the refs UI and changing the
behaviour for tag decorations makes them match branch decorations where
log -> decoration -> log shows the log of the decoration.

Reported-by: Ferry Huberts <mailings@hupie.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoReturn proper HTTP response when accessing info/
Lukas Fleischer [Thu, 15 Jan 2015 18:47:42 +0000 (19:47 +0100)]
Return proper HTTP response when accessing info/

Currently, when a user directly accesses the info command of a
repository, we exit cgit without printing anything to stdout, bringing
up error messages like "502 Bad Gateway" or "An error occurred while
reading CGI reply (no response received)". Instead of bailing out, at
least print the HTTP headers, including a reasonable error message.

Reported-by: Janus Troelsen
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years agogit: update to v2.2.2
Christian Hesse [Tue, 13 Jan 2015 07:53:56 +0000 (08:53 +0100)]
git: update to v2.2.2

Update to git version v2.2.2, no changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years agoui-diff: don't link to single file diff stat
John Keeping [Mon, 29 Dec 2014 22:27:55 +0000 (22:27 +0000)]
ui-diff: don't link to single file diff stat

Seeing the diff stat for a single file is pretty useless, so reset the
diff type before generating the links to individual files in the diff
stat so that the links will show a useful diff.

Reported-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agoui-patch: match git-format-patch(1) output
John Keeping [Sun, 28 Dec 2014 13:10:33 +0000 (13:10 +0000)]
ui-patch: match git-format-patch(1) output

Using (DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH) causes Git to emit a
"---" line between the commit message and the body of the patch, which
fixes a regression introduced in commit 455b598 (ui-patch.c: Use
log_tree_commit() to generate diffs, 2013-08-20), prior to which we
inserted the "---" line ourselves.

DIFF_FORMAT_SUMMARY is added so that we match the output of
git-format-patch(1) without the "-p" option.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years agot0108: modernize style
John Keeping [Sun, 28 Dec 2014 13:10:32 +0000 (13:10 +0000)]
t0108: modernize style

* &&-chaining
* use test_cmp instead of cmp
* use strip_headers instead of knowing how many lines there will be

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoRevert "git: use xz compressed archive for download"
Jason A. Donenfeld [Wed, 24 Dec 2014 11:50:11 +0000 (12:50 +0100)]
Revert "git: use xz compressed archive for download"

This reverts commit a87c9d8a9779eab0499efd3c44e090a28c7d1cdf.

We want to make OpenBSD people happy.

10 years agoUse split_ident_line() in parse_user()
Lukas Fleischer [Wed, 24 Dec 2014 07:50:11 +0000 (08:50 +0100)]
Use split_ident_line() in parse_user()

Use Git's built-in ident line splitting algorithm instead of
reimplementing it. This does not only simplify the code but also makes
sure that cgit is consistent with Git when it comes to author parsing.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
10 years agofooter: link back to cgit home page
Jason A. Donenfeld [Wed, 19 Mar 2014 09:11:45 +0000 (03:11 -0600)]
footer: link back to cgit home page

The footer has always been overrideable using the footer= in cgitrc, so
this won't anger anybody who cares about their footer.

10 years agoui-shared: show absolute time in tooltip for relative dates
John Keeping [Sat, 20 Dec 2014 13:59:39 +0000 (13:59 +0000)]
ui-shared: show absolute time in tooltip for relative dates

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agogit: use xz compressed archive for download
Christian Hesse [Wed, 24 Dec 2014 02:14:07 +0000 (19:14 -0700)]
git: use xz compressed archive for download

10 years agomatch other common markdown file extensions
Chris Burroughs [Thu, 17 Jul 2014 13:44:13 +0000 (09:44 -0400)]
match other common markdown file extensions

10 years agorepolist: add owner-filter
Chris Burroughs [Mon, 4 Aug 2014 13:23:08 +0000 (09:23 -0400)]
repolist: add owner-filter

This allows custom links to be used for repository owners by
configuring a filter to be applied in the "Owner" column in the
repository list.

10 years agoui-shared: add rel-vcs microformat links to HTML header
John Keeping [Fri, 1 Aug 2014 21:14:19 +0000 (22:14 +0100)]
ui-shared: add rel-vcs microformat links to HTML header

As described at https://joeyh.name/rfc/rel-vcs/.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoui-summary: add "rel='vcs-git'" to clone URL links
John Keeping [Fri, 1 Aug 2014 21:14:18 +0000 (22:14 +0100)]
ui-summary: add "rel='vcs-git'" to clone URL links

This is described in the rel-vcs microformat[1].

[1] https://joeyh.name/rfc/rel-vcs/

Signed-off-by: John Keeping <john@keeping.me.uk>