]> granicus.if.org Git - cgit/log
cgit
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>
10 years agoExtract clone URL printing to ui-shared.c
John Keeping [Fri, 1 Aug 2014 21:14:17 +0000 (22:14 +0100)]
Extract clone URL printing to ui-shared.c

This will allow us to reuse the same logic to add clone URL <link/>
elements to the header of all repo-specific pages in order to support
the rel-vcs microformat.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoRemove trailing slash after remove-suffix
Lukas Fleischer [Sat, 13 Dec 2014 10:40:48 +0000 (11:40 +0100)]
Remove trailing slash after remove-suffix

When removing the ".git" suffix of a non-bare repository, also remove
the trailing slash for compatibility with cgit_repobasename().

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
10 years agogit: update to v2.2.1
Christian Hesse [Fri, 19 Dec 2014 07:28:34 +0000 (00:28 -0700)]
git: update to v2.2.1

Update to git version v2.2.1, including API changes.

Signed-off-by: Christian Hesse <mail@eworm.de>
10 years agofilter: fix libravatar email-filter https issue
Christian Hesse [Wed, 10 Sep 2014 09:24:07 +0000 (11:24 +0200)]
filter: fix libravatar email-filter https issue

Serving cgit via https and getting avatar via http gives error messages
about untrusted content. This decides whether or not to use https link
by looking at the environment variable HTTPS, which is set in CGI.

10 years agoui-diff: add "stat only" diff type
John Keeping [Sun, 5 Oct 2014 09:59:05 +0000 (10:59 +0100)]
ui-diff: add "stat only" diff type

This prints the diffstat but stops before printing (or generating) any
of the body of the diff.

No cgitrc option is added here so that we can wait to see how useful
this is before letting people set it as the default.

Suggested-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoChange "ss" diff flag to an enum
John Keeping [Sun, 5 Oct 2014 09:59:04 +0000 (10:59 +0100)]
Change "ss" diff flag to an enum

This will allow us to introduce a new "stat only" diff mode without
needing an explosion of mutually incompatible flags.

The old "ss" query parameter is still accepted in order to avoid
breaking saved links, but we no longer generate any URIs using it;
instead the new "dt" (diff type) parameter is used.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoui-shared: remove toggle_ssdiff arg to cgit_diff_link()
John Keeping [Sun, 5 Oct 2014 09:59:03 +0000 (10:59 +0100)]
ui-shared: remove toggle_ssdiff arg to cgit_diff_link()

This argument is never used with a value other than zero, so remove it
and simplify the code.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoui-shared: remove toggle_ssdiff arg to cgit_commit_link()
John Keeping [Sun, 5 Oct 2014 09:59:02 +0000 (10:59 +0100)]
ui-shared: remove toggle_ssdiff arg to cgit_commit_link()

This argument is never used with a value other than zero, so remove it
and simplify the code.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agogit: update to v2.0.4
John Keeping [Sun, 3 Aug 2014 14:51:42 +0000 (15:51 +0100)]
git: update to v2.0.4

No CGit changes required.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoAlways check if README exists in choose_readme()
Lukas Fleischer [Sun, 27 Jul 2014 18:50:59 +0000 (20:50 +0200)]
Always check if README exists in choose_readme()

Specifying a nonexistent README file via the readme option is sometimes
useful, e.g. when using scan-path and setting a global default.
Currently, we check whether there is only one option in the readme
option and, if so, we choose that file without checking whether it
exists. As a consequence, all repositories are equipped with an about
link in the aforementioned scenario, even if there is no about file.
Remove the early check for the number of keys and always check whether
the file exists instead.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
10 years agocgitrc.5: we mean a cgi response, not request
Jason A. Donenfeld [Fri, 1 Aug 2014 15:37:27 +0000 (17:37 +0200)]
cgitrc.5: we mean a cgi response, not request

10 years agoui-stats.c: set parent pointer to NULL after freeing it
John Keeping [Sun, 27 Jul 2014 10:56:20 +0000 (11:56 +0100)]
ui-stats.c: set parent pointer to NULL after freeing it

We do this everywhere else, so we should be doing it here as well.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agogit: update to v2.0.3
John Keeping [Sun, 27 Jul 2014 10:56:19 +0000 (11:56 +0100)]
git: update to v2.0.3

This is slightly more involved than just bumping the version number
because it pulls in a change to convert the commit buffer to a slab,
removing the "buffer" field from "struct commit".  All sites that access
"commit->buffer" have been changed to use the new functions provided for
this purpose.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoparsing.c: make commit buffer const
John Keeping [Sun, 27 Jul 2014 10:56:18 +0000 (11:56 +0100)]
parsing.c: make commit buffer const

This will be required in order to incorporate the changes to commit
buffer handling in Git 2.0.2.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years agoBump version. v0.10.2
Jason A. Donenfeld [Mon, 30 Jun 2014 13:15:35 +0000 (15:15 +0200)]
Bump version.

10 years agoremove debug fprinf() calls that sneaked in with commit 79c985
Christian Hesse [Sun, 29 Jun 2014 16:52:16 +0000 (18:52 +0200)]
remove debug fprinf() calls that sneaked in with commit 79c985

10 years agogit: update to 2.0.1
Christian Hesse [Sat, 28 Jun 2014 14:04:17 +0000 (16:04 +0200)]
git: update to 2.0.1

Everything works just bumping the version in Makefile and commit hash in
submodule. No code changes required.

10 years agoui-patch: Flush stdout after outputting data
John Keeping [Wed, 11 Jun 2014 20:01:50 +0000 (21:01 +0100)]
ui-patch: Flush stdout after outputting data

It looks like cached patches are truncated to the nearest 1024-byte
boundary in the patch body. E.g.:

> mricon@nikko:[/tmp]$ wget -O no-cache
> "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/?id=6e1b4fdad5157bb9e88777d525704aba24389bee"
...
> 2014-06-11 15:34:51 (80.4 MB/s) - ‘no-cache’ saved [4767]

Patch is complete, without truncation. Next hit, with cache in place:

> mricon@nikko:[/tmp]$ wget -O yes-cache
> "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/?id=6e1b4
fdad5157bb9e88777d525704aba24389bee"
...
> 2014-06-11 15:35:01 (17.0 MB/s) - ‘yes-cache’ saved [4096/4096]

Length truncated to 4096. The cache on disk looks truncated as well, so
the bug must me during the process of saving cache. The same is true for
larger patches:

> mricon@nikko:[/tmp]$ wget -O no-cache
> "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/?id=2840c566e95599cd60c7143762ca8b49d9395050"
...
> 2014-06-11 15:41:33 (1.07 MB/s) - ‘no-cache’ saved [979644]

979644 bytes with a cache-miss

> mricon@nikko:[/tmp]$ wget -O yes-cache
> "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/?id=2840c
566e95599cd60c7143762ca8b49d9395050"
...
> 2014-06-11 15:41:46 (1.05 MB/s) - ‘yes-cache’ saved [978944]

978944 (956KB exactly) with a cache-hit

Since the "html" functions use raw write(2) to STDIO_FILENO, we don't
notice problems with most pages, but raw patches write using printf(3).
This is fine if we're outputting straight to stdout since the buffers
are flushed on exit, but we close the cache output before this, so the
cached output ends up being truncated.

Make sure the buffers are flushed when we finish outputting a patch so
that we avoid this.

No other UIs use printf(3) so we do not need to worry about them.

Actually, it's slightly more interesting than this... since we don't set
GIT_FLUSH, Git decides whether or not it will flush stdout after writing
each commit based on whether or not stdout points to a regular file (in
maybe_flush_or_die()).

Which means that when writing directly to the webserver, Git flushes
stdout for us, but when we redirect stdout to the cache it points to a
regular file so Git no longer flushes the output for us.

The patch is still correct, but perhaps the full explanation is
interesting!

Reported-by: Konstantin Ryabitsev <mricon@kernel.org>
10 years agoui-log: ignore unhandled arguments
John Keeping [Sat, 28 Jun 2014 13:55:06 +0000 (15:55 +0200)]
ui-log: ignore unhandled arguments

If you search for a bogus range string here:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/

Using something like "range" and "qwerty123456", it returns an "Internal
Server Error" and the following in the logs:

> [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] fatal:
> ambiguous argument 'qwerty123456': unknown revision or path not in the
> working tree., referer:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
> [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] Use '--' to
> separate paths from revisions, like this:, referer:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
> [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] 'git <command>
> [<revision>...] -- [<file>...]', referer:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
> [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] Premature end
> of script headers: cgit, referer:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/

The cache will kick in, so if you search for the same string again,
it'll show an empty range, so you have to change the bogus strings each
time.

This is because we just pass the arguments straight to Git's revision
parsing machinery which die()s if it cannot parse an argument, printing
the above to stderr and exiting.

The patch below makes it a bit friendlier by just ignoring unhandled
arguments, but I can't see an easy way to report errors when we can't
parse revision arguments without losing the flexibility of supporting
all of the revision specifiers supported by Git.

Reported-by: Konstantin Ryabitsev <mricon@kernel.org>
10 years agogit: update for git 2.0
Christian Hesse [Thu, 29 May 2014 15:35:46 +0000 (17:35 +0200)]
git: update for git 2.0

prefixcmp() and suffixcmp() have been remove, functionality is now
provided by starts_with() and ends_with(). Retrurn values have been
changed, so instead of just renaming we have to fix logic.
Everything else looks just fine.

10 years agoremove trailing whitespaces from source files
Christian Hesse [Thu, 17 Apr 2014 09:55:46 +0000 (11:55 +0200)]
remove trailing whitespaces from source files

10 years agogit: update to 1.9.2
Christian Hesse [Thu, 10 Apr 2014 03:34:34 +0000 (05:34 +0200)]
git: update to 1.9.2

Everything works just bumping the version in Makefile and commit hash in
submodule. No code changes required.

10 years agoFix cgit_parse_url when a repo url is contained in another repo url
Julian Maurice [Fri, 28 Mar 2014 22:18:29 +0000 (23:18 +0100)]
Fix cgit_parse_url when a repo url is contained in another repo url

For example, if I have two repos (remove-suffix is enabled):
  /foo
  /foo/bar

http://cgit/foo/bar/ is interpreted as "repository 'foo', command 'bar'"
instead of "repository 'foo/bar'"

10 years agoMakefile: use more reliable git tarball mirror
Jason A. Donenfeld [Thu, 20 Mar 2014 17:20:01 +0000 (11:20 -0600)]
Makefile: use more reliable git tarball mirror

10 years agogit: update to 1.9.1
Christian Hesse [Thu, 20 Mar 2014 13:41:16 +0000 (14:41 +0100)]
git: update to 1.9.1

Everything works just bumping the version in Makefile and commit hash
in submodule. No code changes required.

10 years agofilter: add libravatar email-filter lua script
Christian Hesse [Thu, 13 Mar 2014 10:55:49 +0000 (11:55 +0100)]
filter: add libravatar email-filter lua script

10 years agoBump version. v0.10.1
Jason A. Donenfeld [Thu, 27 Feb 2014 23:12:08 +0000 (00:12 +0100)]
Bump version.

10 years agoui-refs: simplify cmp_age logic
Jason A. Donenfeld [Wed, 26 Feb 2014 15:57:15 +0000 (16:57 +0100)]
ui-refs: simplify cmp_age logic

The check in parse_user that eventually makes it into committer_date and
tagger_date is:

else if (mode == 3 && isdigit(*p)) {
    *date = atol(p);
    mode++;
}

Since isdigit('-') is always false, date will never be negative. Thus
the sign of this function:

static int cmp_age(int age1, int age2)
{
    if (age1 != 0 && age2 != 0)
        return age2 - age1;

    if (age1 == 0 && age2 == 0)
        return 0;

    if (age1 == 0)
        return +1;

    return -1;
}

Will always be the same as the sign of this function:

static inline int cmp_age(int age1, int age2)
{
    return age2 - age1;
}

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Idea-by: Lukas Fleischer <cgit@cryptocrack.de>
10 years agoRemove unused parameter from cgit_print_snapshot()
Lukas Fleischer [Sat, 8 Feb 2014 13:37:29 +0000 (14:37 +0100)]
Remove unused parameter from cgit_print_snapshot()

10 years agoprint download link for reference string length == 1
Christian Hesse [Thu, 20 Feb 2014 19:48:45 +0000 (20:48 +0100)]
print download link for reference string length == 1

I have a number of repositories that start tagging with just '1' and
count up. Actually references with sting length of one are skipped, this
patch changes that.