]> granicus.if.org Git - cgit/log
cgit
9 years agoscan-tree: remove useless strdup()
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>
9 years agocgit.c: remove useless null check
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>
9 years agogit: update to v2.6.1
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>
9 years agomime: rewrite detection function
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>
9 years agoui-summary: send images plain for about page
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>
9 years agorefactor get_mimetype_from_file() to get_mimetype_for_filename()
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>
9 years agomove get_mimetype_from_file() to shared
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>
9 years agocmd: fix command definition
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>
9 years agocmd: no need for pre function hook now
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>
9 years agoui-shared: cache errors for "dynamic TTL"
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>
9 years agocmd: remove "want_layout" field
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>
9 years agotree: move layout into page function
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>
9 years agotag: move layout into page function
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>
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>