all repos — cgit @ git.aaoth.xyz

a hyperfast web frontend for git written in c

177e6c41
makefile: bump version
la-ninpre leobrekalini@gmail.com
Wed, 03 Aug 2022 11:46:28 +0300
f35c9ac9
fix logo size and add html id to it
la-ninpre leobrekalini@gmail.com
Wed, 07 Jul 2021 15:34:59 +0300
81b5fded
Merge remote-tracking branch 'upstream/master' into git.aaoth.xyz
la-ninpre leobrekalini@gmail.com
Wed, 07 Jul 2021 15:23:56 +0300
8699fe74
css: fix image widths
la-ninpre leobrekalini@gmail.com
Wed, 07 Jul 2021 15:20:12 +0300
6c5d4fef
css: remove nowrap in table.list, decrease div.content margin
la-ninpre leobrekalini@gmail.com
Fri, 02 Apr 2021 21:41:48 +0300
316ddeb7
favicon: replace favicon
la-ninpre leobrekalini@gmail.com
Fri, 02 Apr 2021 21:12:32 +0300
ccd0d09e
Merge remote-tracking branch 'upstream/master' into git.aaoth.xyz
la-ninpre leobrekalini@gmail.com
Tue, 30 Mar 2021 19:59:13 +0300
d366ec1e
ui-repolist: make table headers lowercase

>:(
la-ninpre leobrekalini@gmail.com
Sun, 06 Dec 2020 22:23:24 +0300
e5223c72
ui-shared: fix another typo

oops, forgot closing tag. it seems that i have no brain
la-ninpre leobrekalini@gmail.com
Mon, 30 Nov 2020 01:58:00 +0300
5ffe470f
ui-shared: fix typo
la-ninpre leobrekalini@gmail.com
Mon, 30 Nov 2020 01:53:23 +0300
8a6f98af
ui-shared: add content-security-policy header
la-ninpre leobrekalini@gmail.com
Mon, 30 Nov 2020 01:49:23 +0300
452a6363
fix typo in about.md
la-ninpre leobrekalini@gmail.com
Wed, 25 Nov 2020 20:33:45 +0300
e2525ea5
other: use markdown file for root-readme

it seems that about-formatting rule is used on root-readme too. because
of that i don't need html file. this is kinda odd, but okay.
la-ninpre leobrekalini@gmail.com
Wed, 18 Nov 2020 22:11:26 +0300
23e98ac4
other: add about page

this intended to be used as `root-readme` as specified in cgitrc(5).
la-ninpre leobrekalini@gmail.com
Wed, 18 Nov 2020 21:17:08 +0300
6805720a
css: fix pre block style
la-ninpre leobrekalini@gmail.com
Tue, 17 Nov 2020 20:56:59 +0300
edf5aac3
css: add style for code blocks
la-ninpre leobrekalini@gmail.com
Tue, 17 Nov 2020 18:32:49 +0100
69061b9e
filters: add lowdown filter for readme

it's suitable only for converting markdown to html, but i don't need
more. lowdown is better than about-formatting.sh because it doesn't
require shell. as i run this server on openbsd, web server is chrooted
so every binary should be copied to chroot directory. since chroot is
considered a security measure to restrict shell access, copying shell
executable to chroot directory would be stupid.
la-ninpre leobrekalini@gmail.com
Fri, 06 Nov 2020 20:05:01 +0100
7d8fec7e
logo: fix mode
la-ninpre leobrekalini@gmail.com
Mon, 02 Nov 2020 13:33:43 +0300
15b44e46
logo: replace with aaoth's
la-ninpre leobrekalini@gmail.com
Thu, 29 Oct 2020 12:28:37 +0100
bdc40597
favicon: replace favicon
la-ninpre leobrekalini@gmail.com
Wed, 28 Oct 2020 21:43:03 +0100
ad881666
css: restyle css

fix colors, page width, table borders
la-ninpre leobrekalini@gmail.com
Wed, 28 Oct 2020 21:34:29 +0100
5128d091
disable unsafe inline styles and scripts
la-ninpre leobrekalini@gmail.com
Wed, 28 Oct 2020 17:23:13 +0100
adcc4f82
tests: try with commit-graph

Git 2.24.0 enabled commit-graph by default and caused crashes without
necessary update. Let's test to work with commit-graph.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 21 Oct 2020 22:16:57 +0200
a1039ab1
tests: do not copy snapshots to /tmp/

No idea why this was added... Possibly to inspect the snapshot manually?
Let's drop it.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 21 Oct 2020 21:31:52 +0200
a4de0e81
global: replace hard coded hash length

With sha1 we had a guaranteed length of 40 hex chars. This changes now
that we have to support sha256 with 64 hex chars... Support both.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 20 Oct 2020 23:46:09 +0200
779631c6
global: replace references to 'sha1' with 'oid'

For some time now sha1 is considered broken and upstream is working to
replace it with sha256. Replace all references to 'sha1' with 'oid',
just as upstream does.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 20 Oct 2020 23:32:45 +0200
629659d2
git: update to v2.29.0

Update to git version v2.29.0, this requires changes for these
upstream commits:

* dbbcd44fb47347a3fdbee88ea21805b7f4ac0b98
  strvec: rename files from argv-array to strvec

* 873cd28a8b17ff21908c78c7929a7615f8c94992
  argv-array: rename to strvec

* d70a9eb611a9d242c1d26847d223b8677609305b
  strvec: rename struct fields

* 6a67c759489e1025665adf78326e9e0d0981bab5
  test-lib-functions: restrict test_must_fail usage

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 06 Oct 2020 16:32:08 +0200
205837d4
git: update to v2.28.0

Update to git version v2.28.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 27 Jul 2020 20:36:14 +0200
f780396c
git: update to v2.27.0

Update to git version v2.27.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 02 Jun 2020 10:10:15 +0200
0462f08d
git: update to v2.26.0

Update to git version v2.26.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 09 Mar 2020 09:51:05 +0100
55fa25ad
Bump version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 13 Mar 2020 17:49:52 -0600
6a8d6d4b
global: use proper accessors for maybe_tree

A previous commit changed ->tree to ->maybe_tree throughout, which may
have worked at the time, but wasn't safe, because maybe_tree is loaded
lazily. This manifested itself in crashes when using the "follow" log
feature. The proper fix is to use the correct contextual accessors
everytime we want access to maybe_tree. Thankfully, the commit.cocci
script takes care of creating mostly-correct patches that we could then
fix up, resulting in this commit here.

Fixes: 255b78f ("git: update to v2.18.0")
Reviewed-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 12 Mar 2020 20:52:35 -0600
892ba8c3
ui-snapshot: add support for zstd compression

This patch adds support for zstd [0] compressed snapshots (*.tar.zst).
We enable multiple working threads (-T0), but keep default compression
level. The latter can be influenced by environment variable.

[0] https://www.zstd.net/

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 26 Feb 2020 09:12:21 +0100
cc230bf0
tests: add tests for xz compressed snapshots

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 26 Feb 2020 09:19:00 +0100
06671f4b
ui-snapshot: add support for lzip compression

This patch adds support for lzip [1] compressed snapshots (*.tar.lz)

[1] https://www.nongnu.org/lzip/

Signed-off-by: Hanspeter Portner <dev@open-music-kontrollers.ch>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Hanspeter Portner dev@open-music-kontrollers.ch
Fri, 16 Aug 2019 23:40:19 +0200
fde897b8
git: update to v2.25.1

Update to git version v2.25.1.

No changes required.
Christian Hesse mail@eworm.de
Mon, 17 Feb 2020 09:08:02 +0100
5e49023b
tests: allow to skip git version tests

This allows to run tests non-tagged git checkout or when bisecting.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 13 Jan 2020 21:04:46 +0100
fa146cca
Bump version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2020 15:04:14 -0500
bd68c988
git: update to v2.25.0

Update to git version v2.25.0.

Upstream renamed 'init_display_notes()' to 'load_display_notes()' in
commit 1e6ed5441a61b5085978e0429691e2e2425f6846 ("notes: rename to
load_display_notes()").

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Thu, 26 Dec 2019 00:02:23 +0100
ca98c9e7
tests: skip tests if strace is not functional

Chances are that strace is available but not functional due to
restricted permissions:

strace: test_ptrace_get_syscall_info: PTRACE_TRACEME: Operation not permitted
strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted
+++ exited with 1 +++

Just skip the tests then.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 11 Dec 2019 10:55:24 +0100
d8e5dd25
git: update to v2.24.1

Update to git version v2.24.1.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 10 Dec 2019 20:40:45 +0100
583aa5d8
ui-repolist: do not return unsigned (negative) value

The function read_agefile() returns time_t, which is a signed datatime.
We should not return unsigned (negative) value here.

Reported-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 22 Nov 2019 11:09:50 +0100
bfabd451
git: update to v2.24.0

Update to git version v2.24.0.

Never use get_cached_commit_buffer() directly, use repo_get_commit_buffer()
instead. The latter calls the former anyway. This fixes segmentation fault
when commit-graph is enabled and get_cached_commit_buffer() does not return
the expected result.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 23 Oct 2019 23:21:54 +0200
8fc0c81b
git: update to v2.23.0

Update to git version v2.23.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Thu, 13 Jun 2019 21:41:37 +0200
034e3c7d
git: update to v2.22.0

Update to git version v2.22.0.

Upstream commit bce9db6d ("trace2: use system/global config for default
trace2 settings") caused a regression. We have to unset HOME and
XDG_CONFIG_HOME before early loading of config from trace2 code kicks in.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 13 May 2019 21:41:37 +0200
e1ad15d3
ui-tree: allow per repository override for enable-blame

The blame operation can cause high cost in terms of CPU load for huge
repositories. Let's add a per repository override for enable-blame.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 26 Feb 2019 17:08:31 +0100
27a6d69a
tests: successfully validate rc versions

For testing versions the version string differs for git tag (v2.22.0-rc3)
and tarball file name (2.22.0.rc3). Let's fix validation for testing
versions.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 04 Jun 2019 13:49:36 +0200
985fba80
git: update to v2.21.0

Update to git version v2.21.0. Required changes follow upstream commits:

* 6a7895fd8a3bd409f2b71ffc355d5142172cc2a0
  (commit: prepare free_commit_buffer and release_commit_memory for
  any repo)

* e092073d643b17c82d72cf692fbfaea9c9796f11
  (tree.c: make read_tree*() take 'struct repository *')

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
Christian Hesse mail@eworm.de
Sun, 24 Feb 2019 21:19:46 +0100
68de710c
ui-ssdiff: ban strncat()

Git version v2.21.0 marks strncat() as banned (commit
ace5707a803eda0f1dde3d776dc3729d3bc7759a), so replace it.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 12 Feb 2019 21:53:02 +0100
ccba7eb9
global: make 'char *path' const where possible

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 02 Jan 2019 17:25:01 +0100
54c407a7
ui-shared: restrict to 15 levels

Perhaps a more ideal version of this would be to not print breadcrumbs
at all for paths that don't exist in the given repo at the given oid.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Fydor Wire Snark <wsnark@tuta.io>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 20 May 2019 21:45:12 +0200
bd0293f5
ui-diff,ui-tag: don't use htmlf with non-formatted strings

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Chris Mayo aklhfex@gmail.com
Thu, 21 Feb 2019 19:57:23 +0000
5bd7e9bc
ui-ssdiff: resolve HTML5 validation errors

- Remove ids from anchor elements. They were unusable because they were
  duplicated between files and versions of files.
- Always close span, with html().
- Fix missing / on closing tr element in cgit_ssdiff_header_end().

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Chris Mayo aklhfex@gmail.com
Thu, 21 Feb 2019 19:56:05 +0000
7d87cd3a
filters: migrate from luacrypto to luaossl

luaossl has no upstream anymore and doesn't support OpenSSL 1.1,
whereas luaossl is quite active.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 03 Jan 2019 02:11:14 +0100
e23f6346
ui-shared: fix broken sizeof in title setting and rewrite

The old algorithm was totally incorrect. While we're at it, use «
instead of \, since it makes more sense.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 02 Jan 2019 07:52:12 +0100
55ebd5e9
git: update to v2.20.0

Update to git version v2.20.0. Required changes follow upstream commits:

* 00436bf1b1c2a8fe6cf5d2c2457d419d683042f4
  (archive: initialize archivers earlier)

* 611e42a5980a3a9f8bb3b1b49c1abde63c7a191e
  (xdiff: provide a separate emit callback for hunks)

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 20 Nov 2018 17:31:21 +0100
441dac1d
ui-blame: set repo for sb

Otherwise recent git complains and crashes with: "BUG: blame.c:1787:
repo is NULL".

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 22 Nov 2018 01:49:55 +0100
898b9e19
auth-filter: pass url with query string attached

Otherwise redirections come out wrong.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 21 Nov 2018 03:16:11 +0100
a2285574
git: use xz compressed archive for download

Upstream will stop providing gz compressed source tarballs [0], so stop
using them.

[0] https://lists.zx2c4.com/pipermail/cgit/2018-November/004254.html

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 20 Nov 2018 23:55:03 +0100
2c9f56f3
git: update to v2.19.1

Update to git version v2.19.1. Required changes follow upstream commits:

* commit: add repository argument to get_cached_commit_buffer
  (3ce85f7e5a41116145179f0fae2ce6d86558d099)

* commit: add repository argument to lookup_commit_reference
  (2122f6754c93be8f02bfb5704ed96c88fc9837a8)

* object: add repository argument to parse_object
  (109cd76dd3467bd05f8d2145b857006649741d5c)

* tag: add repository argument to deref_tag
  (a74093da5ed601a09fa158e5ba6f6f14c1142a3e)

* tag: add repository argument to lookup_tag
  (ce71efb713f97f476a2d2ab541a0c73f684a5db3)

* tree: add repository argument to lookup_tree
  (f86bcc7b2ce6cad68ba1a48a528e380c6126705e)

* archive.c: avoid access to the_index
  (b612ee202a48f129f81f8f6a5af6cf71d1a9caef)

* for_each_*_object: move declarations to object-store.h
  (0889aae1cd18c1804ba01c1a4229e516dfb9fe9b)

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:27:00 +0200
a96f2890
ui-ssdiff: ban strcat()

Git upstream bans strcat() with commit:

  banned.h: mark strcat() as banned
  1b11b64b815db62f93a04242e4aed5687a448748

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:23:36 +0200
0899eb64
ui-ssdiff: ban strncpy()

Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:22:26 +0200
2fc008d6
ui-shared: ban strcat()

Git upstream bans strcat() with commit:

  banned.h: mark strcat() as banned
  1b11b64b815db62f93a04242e4aed5687a448748

To avoid compiler warnings from gcc 8.1.x we get the hard way.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 20:33:02 +0200
edb3403f
ui-patch: ban sprintf()

Git upstream bans sprintf() with commit:

  banned.h: mark sprintf() as banned
  cc8fdaee1eeaf05d8dd55ff11f111b815f673c58

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:18:37 +0200
7f75647b
ui-log: ban strncpy()

Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:16:11 +0200
71ba7187
ui-log: ban strcpy()

Git upstream bans strcpy() with commit:

  automatically ban strcpy()
  c8af66ab8ad7cd78557f0f9f5ef6a52fd46ee6dd

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:08:33 +0200
60a93004
parsing: ban sprintf()

Git upstream bans sprintf() with commit:

  banned.h: mark sprintf() as banned
  cc8fdaee1eeaf05d8dd55ff11f111b815f673c58

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:14:32 +0200
7cde5885
parsing: ban strncpy()

Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 28 Aug 2018 18:11:50 +0200
b0fc647f
filters: generate anchor links from markdown

This makes the markdown filter generate anchor links for headings.

Signed-off-by: Christian Hesse <mail@eworm.de>
Tested-by: jean-christophe manciot <actionmystique@gmail.com>
Christian Hesse mail@eworm.de
Fri, 13 Jul 2018 21:44:50 +0200
824138e5
Bump version.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 03 Aug 2018 16:26:14 +0200
53efaf30
clone: fix directory traversal

This was introduced in the initial version of this code, way back when
in 2008.

$ curl http://127.0.0.1/cgit/repo/objects/?path=../../../../../../../../../etc/passwd
root:x:0:0:root:/root:/bin/sh
...

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Jann Horn <jannh@google.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 03 Aug 2018 15:46:11 +0200
c679d901
config: record repo.snapshot-prefix in the per-repo config

Even if we find snapshot-prefix in the repo configuration, we are not
writing it out into the rc- file, so setting the value does not have any
effect.

Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Konstantin Ryabitsev konstantin@linuxfoundation.org
Tue, 17 Jul 2018 12:38:22 -0400
77b6f833
auth-filters: add simple file-based authentication scheme

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 15 Jul 2018 04:45:11 +0200
82856923
auth-filters: use crypt() in simple-authentication

There's no use in giving a silly example to folks who will just copy it,
so instead try to do something slightly better.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 15 Jul 2018 04:18:03 +0200
b73df809
auth-filters: generate secret securely

This is much better than having the user generate it themselves.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 15 Jul 2018 03:22:12 +0200
c4d23d02
auth-filters: do not crash on nil username

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 14 Jul 2018 05:10:28 +0200
93a2c330
auth-filter: do not write more than we've read

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 14 Jul 2018 05:09:27 +0200
c3b5b5f6
auth-filters: do not use HMAC-SHA1

Though SHA1 is broken, HMAC-SHA1 is still fine. But let's not push our
luck; SHA256 is more sensible anyway.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 14 Jul 2018 03:32:00 +0200
c132ef24
Bump version.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 13 Jul 2018 22:40:42 +0200
5dec7f4a
Update COPYING

The address of the Free Software Foundation has changed since the
license was added in 7640d90 ("Add license file and copyright notices",
2006-12-10).  Update the license file from gnu.org¹.

The only non-whitespace changes are the updated FSF address and two
references to the L in LGPL changed from Library to Lesser.

¹ https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Todd Zullinger tmz@pobox.com
Tue, 10 Jul 2018 10:03:34 -0400
089b29a7
css: use correct size in annotated decoration

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 08 Jul 2018 19:14:44 +0200
22583c49
cgitrc.5: add local tar signature example

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 05 Jul 2018 02:38:33 +0200
08a2b1b8
Fix gcc 8.1.1 compiler warnings

    CC ../shared.o
../shared.c: In function ‘expand_macro’:
../shared.c:487:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   strncpy(name, value, len);
   ^~~~~~~~~~~~~~~~~~~~~~~~~
../shared.c:484:9: note: length computed here
   len = strlen(value);
         ^~~~~~~~~~~~~
../ui-shared.c: In function ‘cgit_repobasename’:
../ui-shared.c:136:2: warning: ‘strncpy’ specified bound 1024 equals destination size [-Wstringop-truncation]
  strncpy(rvbuf, reponame, sizeof(rvbuf));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CC ../ui-ssdiff.o
../ui-ssdiff.c: In function ‘replace_tabs’:
../ui-ssdiff.c:142:4: warning: ‘strncat’ output truncated copying between 1 and 8 bytes from a string of length 8 [-Wstringop-truncation]
    strncat(result, spaces, 8 - (strlen(result) % 8));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 04 Jul 2018 03:13:31 +0200
c4167cbd
cgitrc.5: document new signature notes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 03 Jul 2018 20:44:08 +0200
7ba41963
snapshot: support tar signature for compressed tar

This adds support for kernel.org style signatures where the uncompressed
tar archive is signed and compressed later. The signature is valid for
all tar* snapshots.

We have a filter which snapshots may be generated and downloaded. This has
to allow tar signatures now even if tar itself is not allowed. To simplify
things we allow all signatures.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Thu, 07 Jun 2018 21:31:28 +0200
b522a302
extra-head-content: introduce another option for meta tags

This is to support things like go-import meta tags, which are on a
per-repo basis.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 12 Feb 2018 23:10:06 +0100
c4fbb99c
Use string list strdup_strings for mimetypes

There's no need to do this manually with the string list API will do it
for us.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 20 Jun 2018 18:12:09 +0800
90862603
manpage: fix sorting order

You maybe didn't know you had OCD until you saw an
alpha sorted list that has stuff out of order in it.

Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Andy Green andy@warmcat.com
Wed, 20 Jun 2018 18:12:03 +0800
b31e9988
cache: close race window when unlocking slots

We use POSIX advisory record locks to control access to cache slots, but
these have an unhelpful behaviour in that they are released when any
file descriptor referencing the file is closed by this process.

Mostly this is okay, since we know we won't be opening the lock file
anywhere else, but there is one place that it does matter: when we
restore stdout we dup2() over a file descriptor referring to the file,
thus closing that descriptor.

Since we restore stdout before unlocking the slot, this creates a window
during which the slot content can be overwritten.  The fix is reasonably
straightforward: simply restore stdout after unlocking the slot, but the
diff is a bit bigger because this requires us to move the temporary
stdout FD into struct cache_slot.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Wed, 20 Jun 2018 07:29:14 +0200
255b78ff
git: update to v2.18.0

Update to git version v2.18.0. Required changes follow upstream commits:

* Convert find_unique_abbrev* to struct object_id
  (aab9583f7b5ea5463eb3f653a0b4ecac7539dc94)
* sha1_file: convert read_sha1_file to struct object_id
  (b4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8)
* sha1_file: convert sha1_object_info* to object_id
  (abef9020e3df87c441c9a3a95f592fce5fa49bb9)
* object-store: move packed_git and packed_git_mru to object store
  (a80d72db2a73174b3f22142eb2014b33696fd795)
* treewide: rename tree to maybe_tree
  (891435d55da80ca3654b19834481205be6bdfe33)

The changed data types required some of our own functions to be converted
to struct object_id:

  ls_item
  print_dir
  print_dir_entry
  print_object
  single_tree_cb
  walk_tree
  write_tree_link

And finally we use new upstream functions that were added for
struct object_id:

  hashcpy     -> oidcpy
  sha1_to_hex -> oid_to_hex

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
Christian Hesse mail@eworm.de
Mon, 04 Jun 2018 18:49:28 +0200
54d37dc1
global: remove functionality we deprecated for cgit v1.0

The man page states these were deprecated for v1.0. We are past v1.1,
so remove the functionality.

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
Christian Hesse mail@eworm.de
Mon, 18 Jun 2018 11:48:43 +0200
2f8648ff
snapshot: strip bit from struct cgit_snapshot_format

We had a static bit value in struct cgit_snapshot_format. We do not rely
on it and things can be calculated on the fly. So strip it.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 11 Jun 2018 08:26:59 +0200
30a378b5
snapshot: support special value 'all' to enable all formats

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
Christian Hesse mail@eworm.de
Thu, 07 Jun 2018 22:01:50 +0200
c712d5ac
snapshot: support archive signatures

Read signatures from the notes refs refs/notes/signatures/$FORMAT where
FORMAT is one of our archive formats ("tar", "tar.gz", ...).  The note
is expected to simply contain the signature content to be returned when
the snapshot "${filename}.asc" is requested, so the signature for
cgit-1.1.tar.xz can be stored against the v1.1 tag with:

	git notes --ref=refs/notes/signatures/tar.xz add -C "$(
		gpg --output - --armor --detach-sign cgit-1.1.tar.xz |
		git hash-object -w --stdin
	)" v1.1

and then downloaded by simply appending ".asc" to the archive URL.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 16:15:48 +0100
71d14d9c
ui-refs: use shared function to print tag downloads

cgit_compose_snapshot_prefix() is identical to print_tag_downloads(), so
remove the latter and use the function from ui-shared.c instead.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:11:05 +0100
e491eaa5
ui-shared: pass separator in to cgit_print_snapshot_links()

cgit_print_snapshot_links() is almost identical to
print_tag_downloads(), so let's extract the difference to a parameter in
preparation for removing print_tag_downloads() in the next commit.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:08:59 +0100
5b1f42ff
ui-shared: use the same snapshot logic as ui-refs

Make snapshot links in the commit UI use the same prefix algorithm as
those in the summary UI, so that refs starting with the snapshot prefix
are used as-is rather than composed with the prefix repeated.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:06:01 +0100
82aadcfc
ui-shared: rename parameter to cgit_print_snapshot_links()

This is expected to be a ref not a hex object ID, so name it more
appropriately.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:03:21 +0100
63da41a9
ui-shared: remove unused parameter

The "head" parameter to cgit_print_snapshot_links() is never used, so
remove it.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:02:21 +0100
f0047d2d
ui-refs: remove unnecessary sanity check

There is no way for refinfo::refname to be null, and Git will prevent
zero-length refs so this check is unnecessary.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 14:57:22 +0100
00ad47bb
ui-snapshot: filter permitted snapshot requests

Currently the snapshots configuration option only filters which links
are displayed, not which snapshots may be generated and downloaded.
Apply the filter also to requests to ensure that the system policy is
enforced.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:19:52 +0100
c1572bb5
Add "snapshot-prefix" repo configuration

Allow using a user-specified value for the prefix in snapshot files
instead of the repository basename.  For example, files downloaded from
the linux-stable.git repository should be named linux-$VERSION and not
linux-stable-$VERSION, which can be achieved by setting:

	repo.snapshot-prefix=linux

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 14:20:01 +0100
d85e8a98
ui-snapshot: pass repo into get_ref_from_filename()

Prepare to allow a custom snapshot prefix.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 15:18:57 +0100
bd1b2814
ui-shared: pass repo object to print_snapshot_links()

Both call sites of cgit_print_snapshot_links() use the same values for
the snapshot mask and repository name, which are derived from the
cgit_repo structure so let's pass in the structure and access the fields
directly.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
John Keeping john@keeping.me.uk
Sat, 31 Mar 2018 14:05:02 +0100
0bb34ef1
ui-log: highlight annotated tags in different color

Annotated tags have some extra information... Descriptive text or signature.
Highlighting annotated tags in a different color show what tag may be worth
clicking for extra information.

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
Christian Hesse mail@eworm.de
Tue, 05 Jun 2018 12:46:13 +0200
e65ea965
print git version string in footer

This helps tracking what git version cgit uses. The security implications are
low as anybody can look up the version of our submodule anyway. The paranoid
can use a custom footer. :-p

On the other hand this brings potential security issues to the
administrators eyes...

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 04 Jun 2018 22:27:46 +0200
fb804a35
git: update to v2.17.1

Update to git version v2.17.1. Required changes:

* The function 'typename' has been renamed to 'type_name'
  (upstream commit debca9d2fe784193dc2d9f98b5edac605ddfefbb)

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 30 May 2018 10:28:12 +0200
b7591895
ui-blame: free read_sha1_file() buffer after use

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Andy Green andy@warmcat.com
Tue, 19 Jun 2018 17:02:07 +0800
26610aff
ui-tag: Fix inconsistent capitalization

Way back in 2009 all of these were lower cased except this one
occurrence.

Signed-off-by: Jon DeVree <nuxi@vault24.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
Jon DeVree nuxi@vault24.org
Sun, 10 Jun 2018 18:28:49 -0400
7708859c
ui-tree: free read_sha1_file() buffer after use

Free up the buffer allocated in read_sha1_file()

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Andy Green andy@warmcat.com
Wed, 13 Jun 2018 10:02:00 +0800
48f17508
Makefile: drive asciidoc directly for HTML output

This is mostly taken from Git's doc/Makefile, although simplified for
our use.  The output now uses Asciidoc's default CSS which I think looks
a bit nicer than the Docbook formatting; as a result of this we no
longer need our custom .css file.

A side effect of this change is that temporary files generated from the
HTML output no longer conflict with the manpage output format (because
any temporary HTML output files use names derived from the output
filename which includes .html).

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 16 Jun 2018 13:11:09 +0100
33414d78
doc: use consistent id's when generating html files

The html documentation is generated using a2x which calls docbook tools
to do the work.  The generate.consistent.ids parameter ensures that when
the docbook stylesheet assigns an id value to an output element it is
consistent as long as the document structure has not changed.

Having consistent html files reduces frivolous changes between builds.
Distributions can more easily deploy multiple architecture builds and
compare changes between package versions.  End-users avoid needless
changes in files deployed or backed up.

The generate.consistent.ids parameter was added in docbook-xsl-1.77.0.
Older versions gracefully ignore the parameter, so we can pass the
parameter unconditionally.  Most distributions contain docbook-xsl newer
than 1.77.0.  This includes Fedora, Debian, Ubuntu, and RHEL/CentOS 7.
RHEL/CentOS 6 and Debian Wheezy (old stable) ship with an older version,
unsurprisingly.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Todd Zullinger tmz@pobox.com
Tue, 20 Feb 2018 20:36:03 -0500
03f6e34b
cgit: prepare repo before error pages

This fixes a crash when showing a list of all heads in the <select> box
in the header.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 12 Feb 2018 23:23:47 +0100
dbaee267
ui-blame: Allow syntax highlighting

Place file contents into a single block so that syntax highlighting can
be applied in the usual fashion.  Place the alternating color bars
behind the file contents.  Force the default syntax highlighting
background to transparent.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Sat, 28 Oct 2017 21:43:26 -0500
aafc42d8
ui-blame: Make each column into a single table cell

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Tue, 17 Oct 2017 23:17:34 -0500
2b95c9d4
ui-blame: Break out emit_blame_entry into component methods

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Tue, 17 Oct 2017 23:17:33 -0500
6b5b655f
ui-blame: Distinguish hashes column from lines column

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Tue, 17 Oct 2017 23:17:32 -0500
1dd53e3a
git: update to v2.16.0

Update to git version v2.16.0:

* refs: convert resolve_ref_unsafe to struct object_id
  (49e61479be913f67e66bb3fdf8de9475c41b58bd)
* diff: remove DIFF_OPT_SET macro
  (23dcf77f48feb49c54bad09210f093a799816334)
* log: add option to choose which refs to decorate
  (65516f586b69307f977cd67cc45513a296cabc25)
* diff: convert flags to be stored in bitfields
  (02f2f56bc377c287c411947d0e1482aac888f8db)

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Thu, 18 Jan 2018 09:19:31 +0100
5d947ba3
git: update to v2.15.1

Update to git version v2.15.1: With commit 0abe14f6 prepare_packed_git()
moved to packfile.[ch].

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
Christian Hesse mail@eworm.de
Wed, 29 Nov 2017 22:25:42 +0100
67d0f870
global: spelling fixes

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Ville Skyttä ville.skytta@iki.fi
Sat, 14 Oct 2017 22:05:51 +0300
98abe5bb
ui-shared: use type='search' for the search box

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Ville Skyttä ville.skytta@iki.fi
Sat, 14 Oct 2017 22:02:16 +0300
fd069b4c
filter: pipe_fh should be local

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 14 Oct 2017 16:13:07 +0200
9d751e7e
parsing: don't clear existing state with empty input

Since commit c699866 (parsing: clear query path before starting,
2017-02-19), we clear the "page" variable simply by calling
cgit_parse_url() even if the URL is empty.  This breaks a URL like:

	.../cgit?p=about

which is generated when using the "root-readme" configuration option.

This happens because "page" is set to "about" when parsing the query
string before we handle the path (which is empty, but non-null).

It turns out that this is not the only case which is broken, but
specifying repository and page via query options has been broken since
before the commit mentioned above, for example:

	.../cgit?r=git&p=log

Fix both of these by allowing the previous state to persist if PATH_INFO
is empty, falling back to the query parameters if no path has been
requested.

Reported-by: Tom Ryder <tom@sanctum.geek.nz>
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 14 Oct 2017 13:02:53 +0100
1649afdc
ui-tree: link to blame UI if enabled

Create links to the blame page.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Sun, 01 Oct 2017 23:39:09 -0500
c1cd290d
ui-blame: add blame UI

Implement a page which provides the blame view of a specified file.

This feature is controlled by a new config variable, "enable-blame",
which is disabled by default.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Sun, 01 Oct 2017 23:39:08 -0500
f6ffe40d
ui-shared: make a char* parameter const

All cgit_xxx_link functions take const char* for the 'name' parameter,
except for cgit_commit_link, which takes a char* and subsequently
modifies the contents.  Avoiding the content changes, and making it
const char* will avoid the need to make copies of const char* strings
being passed to cgit_commit_link.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Sun, 01 Oct 2017 23:39:07 -0500
9337c7ee
ui-tree: move set_title_from_path to ui-shared

The ui-blame code will also need to call set_title_from_path, so go
ahead and move it to ui-shared.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Sun, 01 Oct 2017 23:39:06 -0500
70787254
html: html_ntxt with no ellipsis

For implementing a ui-blame page, there is need for a function that
outputs a selection from a block of text, transformed for HTML output,
but with no further modifications or additions.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Jeff Smith whydoubt@gmail.com
Sun, 01 Oct 2017 23:39:05 -0500
3b485cc5
cache: flush stdio before restoring FDs

As described in commit 2efb59e (ui-patch: Flush stdout after outputting
data, 2014-06-11), we need to ensure that stdout is flushed before
restoring the file descriptor when writing to the cache.  It turns out
that it's not just ui-patch that is affected by this but also raw diff
which writes to stdout internally.

Let's avoid risking more places doing this by ensuring that stdout is
flushed after writing in fill_slot().

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 24 Apr 2017 19:38:34 +0100
de297883
Use https for submodule

The git protocol provides no transport security. https does provide
transport security and should be preferred by default. https is also
more likely than git to be permitted by firewalls in restricted
environments.

Signed-off-by: Daniel M. Weeks <dan@danweeks.net>
Daniel M. Weeks dan@danweeks.net
Wed, 20 Sep 2017 11:17:29 -0400
51cc456b
ui-plain: print symlink content

We currently ignore symlinks in ui-plain, leading to a 404.  In ui-tree
we print the content of the blob (that is, the path to the target of the
link), so it makes sense to do the same here.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 06 Mar 2017 23:27:23 +0000
113f4b85
cgit: don't set vpath unless repo is set

After the previous two patches, this can be classified as a tidy up
rather than a bug fix, but I think it makes sense to group all of the
tests together before setting up the environment for the command to
execute.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 19 Feb 2017 12:02:37 +0000
c6998666
parsing: clear query path before starting

By specifying the "url" query parameter multiple times it is possible to
end up with ctx.qry.vpath set while ctx.repo is null, which triggers an
invalid code path from cgit_print_pageheader() while printing path
crumbs, resulting in a null dereference.

The previous patch fixed this segfault, but it makes no sense for us to
clear ctx.repo while leaving ctx.qry.path set to the previous value, so
let's just clear it here so that the last "url" parameter given takes
full effect rather than partially overriding the effect of the previous
value.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 19 Feb 2017 12:17:05 +0000
1b4ef678
ui-shared: don't print path crumbs without a repo

cgit_print_path_crumbs() can call repolink() which assumes that ctx.repo
is non-null.  Currently we don't have any commands that set want_vpath
without also setting want_repo so it shouldn't be possible to fail this
test, but the check in cgit.c is in the wrong order so it is possible to
specify a query string like "?p=log&path=foo/bar" to end up here without
a valid repository.

This was found by American fuzzy lop [0].

[0] http://lcamtuf.coredump.cx/afl/

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 19 Feb 2017 12:27:48 +0000
6d3c8bc3
ui-atom: properly escape delimiter in page link

If the delimiter here is '&' then it needs to be escaped for inclusion
in an attribute.  Use html_attrf() to ensure that this happens (we know
that hex won't need escaping, but this makes it clearer what's
happening.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 15 Jan 2017 12:29:38 +0000
86a6d358
git: update to v2.14

Numerous changes were made to git functions to use an object_id
structure rather than sending sha1 hashes as raw unsigned character
arrays.  The functions that affect cgit are: parse_object,
lookup_commit_reference, lookup_tag, lookup_tree, parse_tree_indirect,
diff_root_tree_sha1, diff_tree_sha1, and format_display_notes.

Commit b2141fc (config: don't include config.h by default) made it
necessary to that config.h be explicitly included when needed.

Commit 07a3d41 (grep: remove regflags from the public grep_opt API)
removed one way of specifying the ignore-case grep option.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Jeff Smith whydoubt@gmail.com
Wed, 09 Aug 2017 19:02:56 -0500
3d33b46d
git: update to v2.13.4

Update to git version v2.13.4: With commit 8aee769f (pathspec: copy and free
owned memory) the definition of struct pathspec_item has changed with the
expectation that pathspecs will be managed dynamically. We work around this
a bit by setting up a static structure, but let's allocate the match string
to avoid needing to cast away const.

Updated a patch from John Keeping <john@keeping.me.uk> for git v2.12.1.
Christian Hesse mail@eworm.de
Mon, 24 Jul 2017 17:22:52 +0200
7ce19ba5
Update .mailmap with my new email address

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Thu, 27 Jul 2017 16:20:15 +0200
7ebdb30f
Remove unused variable from sort_section()

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Wed, 05 Apr 2017 06:38:27 +0200
87c47488
ui-repolist: properly sort by age

When empty repos exist, comparing them against an existing repo with a
good mtime might, with particular qsort implementations, not sort
correctly, because of this brokenness:

   if (get_repo_modtime(r1, &t) && get_repo_modtime(r2, &t))

However, sorting by the age column works as expected, so anyway, to tidy
things up, we simply reuse that function.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 30 Mar 2017 13:19:50 +0200
be39d223
ui-patch: fix crash when using path limit

The array passed to setup_revisions() must be NULL-terminated. Fixes a
regression introduced in 455b598 (ui-patch.c: Use log_tree_commit() to
generate diffs, 2013-08-20).

Reported-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Thu, 24 Nov 2016 20:14:54 +0100
5564a5d0
syntax-highlighting: replace invalid unicode with ?
Jason A. Donenfeld Jason@zx2c4.com
Sun, 22 Jan 2017 12:44:44 +0100
91153fd0
git: update to v2.11.0

Update to git version v2.11.0. Function write_archive()
dropped argument (int setup_prefix).
Christian Hesse mail@eworm.de
Wed, 30 Nov 2016 10:43:08 +0100
2b993402
Link with -ldl on GNU Hurd

Debian GNU/Hurd uses the GNU C library.

Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg peter@colberg.org
Fri, 25 Nov 2016 15:57:11 -0500
5ccd9652
git: update to v2.10.2 again

The submodule was accidentally downgraded in commit 8e9ddd21 (Bump
version, 2016-11-23).  Restore v2.10.2 so it matches the makefile again.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 24 Nov 2016 18:59:42 +0000
8e9ddd21
Bump version.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 23 Nov 2016 05:24:26 +0100
81509a22
css: highlight even table rows and skip empty rows

This is stolen from kernel.org css [0].

[0] https://git.kernel.org/cgit-korg-0.10.1.css
Christian Hesse mail@eworm.de
Wed, 06 Jul 2016 22:42:36 +0200
44f8c11c
git: update to v2.10.2

Update to git version v2.10.2, no changes required.
Christian Hesse mail@eworm.de
Sun, 06 Nov 2016 21:47:04 +0100
c330a2e5
ui-blog: fix oid handling

We have to use a pointer for walk_tree_ctx->matched_oid.

This fixes faulty commit 6e4b7b6776eb994e795fa38b2619db6c55e10ecc
(ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid').
Christian Hesse mail@eworm.de
Tue, 11 Oct 2016 08:55:34 +0200
2d59e6a6
shared: remove unused function strlpart()
Christian Hesse mail@eworm.de
Mon, 10 Oct 2016 20:33:30 +0200
3e2e8f1c
shared: remove unused function strrpart()
Christian Hesse mail@eworm.de
Mon, 10 Oct 2016 20:32:17 +0200
7fea585e
ui-repolist: fix memory leak
Christian Hesse mail@eworm.de
Mon, 10 Oct 2016 20:17:51 +0200
32c27e88
Use skip_prefix() to get rid of magic constants

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Sat, 08 Oct 2016 15:45:12 +0200
5fe88a9c
patch: reapply path limit

This was originally applied added in commit eac1b67 (ui-patch: Apply
path limit to generated patch, 2010-06-10) but the ability to limit
patches to particular paths was lost in commit 455b598 (ui-patch.c: Use
log_tree_commit() to generate diffs, 2013-08-20).

The new output is slightly different from the original because Git's
diff infrastructure doesn't give us a way to insert an annotation
immediately after the "---" separator, so the commit has moved below the
diff stat.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 14 Mar 2016 22:41:14 +0000
c1773795
ui-repolist: fix memory leak
Christian Hesse mail@eworm.de
Fri, 07 Oct 2016 15:08:53 +0200
d6a4730d
git: update to v2.10.1

Update to git version v2.10.1, no changes required.
Christian Hesse mail@eworm.de
Tue, 04 Oct 2016 08:51:05 +0200
9dd3c5e9
ui-tree: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 22:17:07 +0200
28185ae4
ui-tag: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 22:14:28 +0200
406f5938
ui-snapshot: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 22:12:11 +0200
6bef566f
ui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 22:10:21 +0200
073a8bb3
ui-plain: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 22:08:19 +0200
85793b81
ui-patch: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 21:51:41 +0200
1a9a75d7
ui-log: replace get_sha1() with get_oid()

Data structures have been replaced already, so use correct function calls.
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 21:44:41 +0200
3a0fd5e6
ui-commit: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 21:41:09 +0200
6e4b7b67
ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

In addition replace memmove() with hashcpy().
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 21:38:49 +0200
aee990b6
cgit: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...
Christian Hesse mail@eworm.de
Thu, 29 Sep 2016 21:16:14 +0200
ef310865
Makefile: remove extra space

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 01 Oct 2016 23:35:04 +0200
927b0ae3
Simplify http_parse_querystring()

Instead of reimplementing URL parameter parsing from scratch, use
url_decode_parameter_name() and url_decode_parameter_value() which are
already provided by Git.

Also, change the return type of http_parse_querystring() to void since
its only caller already ignores the return value.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Thu, 29 Sep 2016 08:38:45 +0200
e18a85b6
ui-tree: remove a fixed size buffer

As libgit.a moves away from using fixed size buffers, there is no
guarantee that PATH_MAX is sufficient for all of the paths in a Git
tree, so we should use a dynamically sized buffer here.

Coverity-Id: 141884
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 13 Aug 2016 11:54:46 +0100
f80b73fa
ui-tag: clean up taginfo

Free the taginfo when we're done with it.  Also reduce the scope of a
couple of variables so that it's clear that this is the only path that
uses the taginfo structure.

Coverity-Id: 141883
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 13 Aug 2016 11:53:24 +0100
b19d889f
shared: make cgit_free_taginfo() public

We will use this function from ui-tag.c in the next patch.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 13 Aug 2016 11:52:51 +0100
d9dff376
shared: remove return value from cgit_free_commitinfo()

This return value is never used and the function always returns NULL.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 13 Aug 2016 11:51:58 +0100
000cf294
tree: allow skipping through single-child trees

If we have only a single element in a directory (for example in Java
package paths), display multiple directories in one go so that it is
possible to navigate directly to the first directory that contains
either files or multiple directories.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 13 Jul 2016 20:19:42 +0100
7e67c648
ui-ssdiff: fix decl-after-statement warnings

git.git's coding style avoids decl-after-statement and we generally try
to follow it but a few warnings have crept in recently.  Fix the one in
ui-ssdiff.c

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Aug 2016 16:14:49 +0100
bead27b7
ui-shared: fix decl-after-statement warnings

git.git's coding style avoids decl-after-statement and we generally try
to follow it but a few warnings have crept in recently.  Fix the ones in
ui-shared.c

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Aug 2016 16:13:30 +0100
35df710a
configfile: fix EOF handling

Currently we can end up passing EOF to isspace(), which is in fact
libgit's sane_isspace which does:

	((sane_ctype[(unsigned char)(x)] & (GIT_SPACE)) != 0)

It is very unlikely that EOF cast to "unsigned char" will end up in a
character that has the GIT_SPACE bit set, but the standard only requires
that EOF be a negative integer, so it could access any value in the
sane_ctype array.

If it does end up returning true for isspace() then this loop will never
terminate, so handle EOF as a special value in the same way as the other
loops in this function.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Aug 2016 15:54:14 +0100
11695a58
git: update to v2.10.0

Upstream continues to replace unsigned char *sha1 with struct
object_id old_oid. This makes the required changes.

The git lib has its own main function now. Rename our main function
to cmd_main, it is called from main then.
Christian Hesse mail@eworm.de
Sun, 04 Sep 2016 12:38:18 +0200
ff9893ac
Fix qry.head leak on error

This is run soon before exiting so it wasn't leaked for long.

Signed-off-by: Richard Maw <richard.maw@gmail.com>
Richard Maw richard.maw@gmail.com
Sat, 02 Jul 2016 20:28:10 +0100
d6b03329
git: update to v2.9.1

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 12 Jul 2016 00:42:41 +0200
40fbefba
Link with -ldl on GNU/kFreeBSD

GNU/kFreeBSD uses the FreeBSD kernel with the GNU C library.

Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg peter@colberg.org
Fri, 01 Jul 2016 22:00:37 -0400
ccf79b35
Fix spelling in man page

Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg peter@colberg.org
Fri, 10 Jun 2016 10:29:07 -0400
590ba455
ui-shared: fix segfault when defbranch is NULL

Not sure if there's a better fix for this.  defbranch is
NULL here on my setup when a crawler hit an invalid URL,
causing strcmp to segfault.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong normalperson@yhbt.net
Wed, 06 Jul 2016 07:08:01 +0000
c19d983e
css: consistent use of empty lines

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 29 Jun 2016 09:37:58 +0200
4fb49864
ui-log: color line changes

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 29 Jun 2016 09:37:57 +0200
9984e7ab
Avoid ambiguities when prettifying snapshot names

When composing snapshot file names for a tag with a prefix of the form
v[0-9] (resp. V[0-9]), the leading "v" (resp. "V") is stripped. This
leads to conflicts if a tag with the stripped name already exists or if
there are tags only differing in the capitalization of the leading "v".
Make sure we do not strip the "v" in these cases.

Reported-by: Juuso Lapinlampi <wub@partyvan.eu>
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Tue, 24 May 2016 18:15:18 +0200
1e039ada
git: update to v2.9.0

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 13 Jun 2016 22:57:12 +0200
5062fbe7
cgit.mk: Use $PKG_CONFIG

PKG_CONFIG is a variable dictated by autoconf standards; it should
be used if set.
Kylie McClain somasis@exherbo.org
Tue, 07 Jun 2016 17:22:35 -0400
7d511204
md2html: use utf-8 and flush output buffer

Otherwise we get the classic Python UTF-8 errors, and the text is all
out of order. While we're at it, switch to python3 so we only have to
support one set of oddball semantics.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Suggested-by: Daniel Campbell <dlcampbell@gmx.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jun 2016 12:27:10 +0200
d88ec849
Hosted on HTTPS now
Jason A. Donenfeld Jason@zx2c4.com
Wed, 24 Feb 2016 18:01:42 +0100
a6572ce1
Bump version.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 07 Jun 2016 14:31:09 +0200
41508c09
git: update to v2.8.3

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Thu, 19 May 2016 23:12:03 +0200
21bf30b0
ui-diff: action='.' is not correct

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 12 May 2016 21:38:59 +0200
c34e2883
forms: action should not be empty

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 12 May 2016 21:29:40 +0200
9afda36e
ui-shared: Remove a name attribute with an empty value

The name attribute is optional in an input element, but it must not be
an empty value.

See: https://html.spec.whatwg.org/#attr-fe-name
See: https://html.spec.whatwg.org/#the-input-element
Juuso Lapinlampi wub@partyvan.eu
Wed, 11 May 2016 18:04:18 +0000
8d05b398
ui-shared: HTML-ize DOCTYPE and <html>

Get rid of the XHTML headers, bringing cgit slowly to the modern age of
HTML.
Juuso Lapinlampi wub@partyvan.eu
Wed, 11 May 2016 18:04:14 +0000
80f12b3e
ui-shared: Simplify cgit_print_error_page() logic
Juuso Lapinlampi wub@partyvan.eu
Wed, 11 May 2016 17:50:09 +0000
86bf5b47
git: update to v2.8.2

Update to git version v2.8.2.

* Upstream commit 1a0c8dfd89475d6bb09ddee8c019cf0ae5b3bdc2 (strbuf: give
  strbuf_getline() to the "most text friendly" variant) changed API.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 30 Apr 2016 16:57:51 +0200
59d8fa1a
ui-log: Simplify decoration code

The decoration code inside of git returns the decoration type, so
utilize this to create the decoration spans.  Additionally, use
prettify_refname(...) to get the shorter name for the ref.

Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
Tim Nordell tim.nordell@logicpd.com
Fri, 26 Feb 2016 14:58:41 -0600
499b2397
ui-log: Do not always emit decoration span

The decoration span does not need to be emited if there aren't
any decorations to show.  This modification saves slightly
on bandwidth.

Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
Tim Nordell tim.nordell@logicpd.com
Fri, 26 Feb 2016 14:57:30 -0600
39735d95
Renamed repo-specific configuration for enable-html-serving in cgitrc.5.txt
Matt Comben matt.comben@itdev.co.uk
Tue, 08 Mar 2016 12:05:09 +0000
e9cbdf64
ui-shared: redirect should not exit early for cache

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 26 Feb 2016 13:24:35 +0100
09a3aa5a
about: path_info might not be valid
Jason A. Donenfeld Jason@zx2c4.com
Fri, 26 Feb 2016 13:14:43 +0100
c424b5cb
tabs: do not use target=_blank
Jason A. Donenfeld Jason@zx2c4.com
Tue, 23 Feb 2016 15:35:32 +0100
46ff6e19
css: fix indentation
Jason A. Donenfeld Jason@zx2c4.com
Tue, 23 Feb 2016 15:14:06 +0100
a0d22c39
css: use less blurry icon for external link

Your mileage may vary, but for me the old icon looks blurry. The new
one is character 0xf08e from OTF font awsome in size 10.
The icon color is black, gray level is adjusted via opacity.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 23 Feb 2016 10:47:25 +0100
1892cd9a
md2html: Do syntax highlighting too
Jason A. Donenfeld Jason@zx2c4.com
Tue, 23 Feb 2016 06:32:03 +0100
a9e9dfc5
git: update to v2.7.2

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 22 Feb 2016 23:25:28 +0100
de6098be
ui-plain: fix to show a repo's root directory listing in plain view

This is to fix the case of accessing http://host.com/cgit.cgi/repo.git/plain/

There is code here to make this case work (match_baselen is set to -1
for top-of-the-tree views) but the unsigned to signed comparison was
always false in this case, causing an empty directory listing without
this fix.

Signed-off-by: Joe Anakata <jea-signup-github@anakata.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Joe Anakata jea-signup-github@anakata.org
Mon, 22 Feb 2016 18:45:53 +0100
94c02bbf
cmd: redirect empty about/ to homepage or summary

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 22 Feb 2016 16:33:49 +0100
5f2664f1
ui-shared: add homepage to tabs

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 22 Feb 2016 16:04:15 +0100
75298209
ui-atom: avoid DATE_STRFTIME

Git's DATE_STRFTIME ignores the timezone argument and just uses the
local timezone regardless of whether the "local" flag is set.

Since Atom accepts ISO8601 dates [1], we can use Git's
DATE_ISO8601_STRICT instead, which does get this right.  Additionally,
we never use the local timezone here so we can use the
date_mode_from_type() wrapper to simplify the code a bit.

[1] https://tools.ietf.org/html/rfc4287#section-3.3

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 08 Feb 2016 15:06:27 +0000
9c15f3c6
Avoid DATE_STRFTIME for long/short dates

Git's DATE_STRFTIME ignores the timezone argument and just uses the
local timezone regardless of whether the "local" flag is set.

Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much
perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a
date_mode_type directly in cgit_date_mode().

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 08 Feb 2016 15:05:54 +0000
bdcbe092
ui-stats: cast pointer before checking for zero

We abuse the "void *util" field as a counter and recently started to
cast it to a uintptr_t to avoid risking nasal demons by performing
arithmetic on a void pointer.

However, compilers are also known to do "interesting" things if they
know that a pointer is or isn't NULL.  Make this safer by checking if
the counter (after casting) is non-zero rather than checking if the
pointer is non-null.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 08 Feb 2016 14:12:35 +0000
a8b9ef8c
ui-stats: if we're going to abuse void*, do it safely
Jason A. Donenfeld Jason@zx2c4.com
Mon, 08 Feb 2016 14:35:47 +0100
85ec9f02
git: update to v2.7.1

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 08 Feb 2016 09:06:47 +0100
17c74eef
ui-shared: remove cgit_print_date()

There are no longer any users of this function.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:08 +0000
eb80b4ed
ui-atom: use show_date directly for atom dates

This will allow us to remove cgit_print_date and use Git's show_date
consistently.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:07 +0000
e68c86e8
ui-shared: use show_date for footer timestamp

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:06 +0000
f2a901d2
ui: show ages in the originator's timezone

This affects the tooltip showing the full time and the case when a date
is sufficiently old to be shown in full rather than as an offset.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:05 +0000
21dcf103
ui-{commit,tag}: show dates in originator's timezone

This is done by switching to Git's show_date() function and the mode
given by cgit_date_mode().

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:04 +0000
360af46f
ui-shared: add cgit_date_mode()

This returns the correct mode value for use with Git's show_date() based
on the current CGit configuration and will be used in the following
patches.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:03 +0000
45c87ca1
parsing: add timezone to ident structures

This will allow us to mimic Git's behaviour of showing times in the
originator's timezone when displaying commits and tags.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:02 +0000
57ea1aa2
ui-shared: remove "format" from cgit_print_age()

We never use any format other than FMT_SHORTDATE, so move that into the
function.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Jan 2016 19:33:01 +0000
23f7dada
ui-tree: put reverse path in title
Jason A. Donenfeld Jason@zx2c4.com
Mon, 18 Jan 2016 15:56:45 +0100
d3756bd7
syntax-highlighting: always use utf-8 to avoid ascii codec issues
Jason A. Donenfeld Jason@zx2c4.com
Mon, 18 Jan 2016 11:14:06 +0100
33bc949a
cache: don't check for match with no key

We call open_slot() from cache_ls() without a key since we simply want
to read the path out of the header.  Should the file happen to contain
an empty key then we end up calling memcmp() with NULL and a non-zero
length.  Fix this by assigning slot->match only if a key is set, which
is always will be in the code paths where we use slot->match.

Coverity-id: 13807
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 16 Jan 2016 11:03:07 +0000
3fbfced7
cache: use size_t for string lengths

Avoid integer truncation on 64-bit systems.

Coverity-id: 13864
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 16 Jan 2016 11:03:06 +0000
baa5ad1f
ui-log: handle parse_commit() errors

If parse_commit() fails, none of the fields in the commit structure will
have been populated so we will dereference NULL when accessing
item->tree.

There isn't much we can do about the error at this point, but if we
return true then we'll try parsing the commit again from print_commit()
and we can report an error to the user at that point.

Coverity-id: 13801
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 16 Jan 2016 11:03:05 +0000
e64d5e04
Bump version
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 15:43:54 +0100
c326f3eb
ui-plain: add enable-html-serving flag

Unrestricts plain/ to contents likely to be executed by browser.
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 14:53:28 +0100
9ca25669
ui-blob: set CSP just in case
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 14:43:43 +0100
92996ac2
ui-blob: always use generic mimetypes
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 14:31:53 +0100
1c581a07
ui-blob: Do not accept mimetype from user
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 14:31:13 +0100
513b3863
ui-shared: prevent malicious filename from injecting headers
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 14:28:37 +0100
4291453e
ui-shared: Avoid new line injection into redirect header
Jason A. Donenfeld Jason@zx2c4.com
Thu, 14 Jan 2016 14:13:39 +0100
4c69241b
Fix missing prototype declarations

Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg peter@colberg.org
Wed, 13 Jan 2016 17:25:07 -0500
9abe4a26
ui-repolist: return HTTP 404 if no repositories found

Return HTTP status code 404 Not found when querying a non-existent
repository, which signals to search engines that a repository no
longer exists. Further, some webservers such as nginx permit
logging requests to different files depending on the HTTP code.

Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg peter@colberg.org
Tue, 08 Dec 2015 12:53:09 -0500
a4014d0d
ui-repolist: extract repo visibility criteria to separate function

Signed-off-by: Peter Colberg <peter@colberg.org>
Peter Colberg peter@colberg.org
Tue, 08 Dec 2015 12:53:08 -0500
da1b8971
Fix segmentation fault in hc()

The ctx.qry.page variable might be unset at this point, e.g. when an
invalid command is passed and cgit_print_pageheader() is called to show
an error message.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Lukas Fleischer lfleischer@lfos.de
Sun, 13 Dec 2015 01:27:13 +0100
559ab5ec
git: update to v2.7.0

Update to git version v2.7.0.

* Upstream commit ed1c9977cb1b63e4270ad8bdf967a2d02580aa08 (Remove
  get_object_hash.) changed API:

  Convert all instances of get_object_hash to use an appropriate
  reference to the hash member of the oid member of struct object.
  This provides no functional change, as it is essentially a macro
  substitution.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 05 Jan 2016 07:38:53 +0100
6edc84bc
ui-repolist: initialize char *buf to NULL

readfile() can fail if the agefile is not readable. Make sure free()
does not free an ininitialized string.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 13 Jan 2016 00:45:03 +0100
4458abf6
filter: avoid integer overflow in authenticate_post

ctx.env.content_length is an unsigned int, coming from the
CONTENT_LENGTH environment variable, which is parsed by strtoul. The
HTTP/1.1 spec says that "any Content-Length greater than or equal to
zero is a valid value." By storing this into an int, we potentially
overflow it, resulting in the following bounding check failing, leading
to a buffer overflow.

Reported-by: Erik Cabetas <Erik@cabetas.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 24 Nov 2015 11:28:00 +0100
ffe09621
about-formatting.sh: comment text out of date
Jason A. Donenfeld Jason@zx2c4.com
Thu, 12 Nov 2015 04:44:32 +0100
143e6525
filters: port syntax-highlighting.py to python 3.x

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 12 Oct 2015 18:23:56 +0200
3f9e14ad
md2html: the default of stdin works fine

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 12 Oct 2015 18:33:21 +0200
c3018991
filters: misc cleanups

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 12 Oct 2015 16:47:47 +0200
ccb42541
md2html: use pure python

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 12 Oct 2015 16:42:48 +0200
76dc7a33
cache: fix resource leak: close file handle before return

Coverity-id: 13910
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 10 Oct 2015 16:56:28 +0200
ed5dccbe
ui-atom: fix resource leak: free allocation from cgit_pageurl

Coverity-id: 13945
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 10 Oct 2015 16:56:27 +0200
144e3c60
ui-atom: fix resource leak: free before return

Coverity-id: 13946
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 10 Oct 2015 16:56:26 +0200
97da17b7
ui-atom: fix resource leak: free allocation from cgit_repourl

Coverity-id: 13947
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 10 Oct 2015 16:56:25 +0200
7320bfa8
ui-blob: fix resource leak: free before return

Coverity-id: 13944
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 10 Oct 2015 16:56:23 +0200
30802126
ui-blob: fix resource leak: free before return

Coverity-id: 13943
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 10 Oct 2015 16:56:24 +0200
08a2b818
ui-plain: fix resource leak: free before assigning NULL

Coverity-id: 13939
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 14:55:50 +0200
979db79a
ui-plain: fix resource leak: free before return

Coverity-id: 13940
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 14:55:49 +0200
51338f76
ui-repolist: fix resource leak: free allocation from cgit_currenturl

Coverity-id: 13930
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 14:55:48 +0200
7ef1a479
ui-repolist: fix resource leak: free before return

Coverity-id: 13931
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 14:55:47 +0200
525c815c
filters: Simplify converters

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 09 Oct 2015 15:13:35 +0200
6edfc167
ui-shared: fix resource leak: free allocation from cgit_hosturl

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:51 +0200
f77e2a8c
ui-shared: return value of cgit_hosturl is not const

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:50 +0200
6f2e4400
cmd: fix resource leak: free allocation from cgit_currenturl and fmtalloc

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:49 +0200
3e244a0c
ui-shared: fix resource leak: free allocation from cgit_currenturl

Coverity-id: 13927
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:48 +0200
c5c0eb87
ui-shared: return value of cgit_currenturl is not const

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:47 +0200
37fce991
ui-shared: fix resource leak: free allocation from cgit_fileurl

Coverity-id: 13918
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:46 +0200
fa5810ed
ui-ssdiff: fix resource leak: free allocation from cgit_fileurl

Coverity-id: 13929
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:45 +0200
896cd69d
ui-tree: fix resource leak: free before return

Coverity-id: 13938
Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 09 Oct 2015 13:15:44 +0200
ad006918
Avoid use of non-reentrant functions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 09 Oct 2015 11:01:04 +0200
35b3c67a
Makefile: fix MAKEFLAGS tests with multiple flags

findstring is defined as $(findstring FIND,IN) so if multiple flags are
set these tests do the wrong thing unless $(MAKEFLAGS) is the second
argument.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 05 Sep 2015 14:32:50 +0100
198a4404
ui-refs: remove useless null check

There is no way that "tag" can be null here.

Coverity-id: 13950
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 08 Oct 2015 23:23:59 +0100
509488d8
ui-blob: remove useless null check

We have already called strlen() on "path" by the time we get here, so we
know it can't be null.

Coverity-id: 13954
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 08 Oct 2015 23:23:58 +0100
687cdf69
scan-tree: remove useless strdup()

parse_configfile() takes a "const char *" and doesn't hold any
references to it after it returns; there is no reason to pass it a
duplicate.

Coverity-id: 13941
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 08 Oct 2015 23:23:57 +0100
94182d60
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>
John Keeping john@keeping.me.uk
Thu, 08 Oct 2015 23:23:56 +0100
978ce8c0
git: update to v2.6.1

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 06 Oct 2015 07:36:40 +0200
73f199be
mime: rewrite detection function

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 17 Aug 2015 14:35:20 +0200
790d2498
ui-summary: send images plain for about page

The about page used to display just fine, but images were broken: The
binary image data was embedded in html code.
Use cgit_print_plain() to send images in plain mode and make them
available on about page.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sun, 16 Aug 2015 14:53:53 +0200
aa943bc9
refactor get_mimetype_from_file() to get_mimetype_for_filename()

* handle mimetype within a single function
* return allocated memory on success

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sun, 16 Aug 2015 14:53:52 +0200
f5c83d7b
move get_mimetype_from_file() to shared

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 14 Aug 2015 16:50:56 +0200
73ef8567
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>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 15:20:23 +0100
03de4733
cmd: no need for pre function hook now

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 14 Aug 2015 15:54:32 +0200
c5975ae5
ui-shared: cache errors for "dynamic TTL"

Most errors we generate are (potentially) transient, such as
non-existent object IDs so we don't want them to be cached forever.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:22 +0100
a420c7ce
cmd: remove "want_layout" field

No commands use this any more.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:21 +0100
9c70c0bf
tree: move layout into page function

This also allows us to return proper HTTP error codes when the requested
tree is not found and display an error message in one case (invalid path
inside valid commit) where we previously just displayed an empty page.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:20 +0100
696a33b6
tag: move layout into page function

This also allows us to return proper HTTP error codes when something
goes wrong.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:19 +0100
a3daa41b
summary: move layout into page function

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:18 +0100
892c5441
stats: move layout into page function

This also allows us to return proper HTTP error codes for invalid
requests.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:17 +0100
6d39dd19
refs: move layout to page function

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:16 +0100
23c17d8f
log: move layout into page function

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:15 +0100
3b220eb2
diff: move layout to page function

The existing "show_ctrls" flag is used to control whether we are running
in an existing page or control the page ourselves.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:14 +0100
c53a15c7
commit: move layout into page function

This allows us to return a proper HTTP status code when an object is not
found by switching from cgit_print_error() to cgit_print_error_page().

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:13 +0100
51d9176e
about: move layout into page functions

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:12 +0100
76498798
ui-shared: add cgit_print_layout_{start,end}()

These will avoid needing to call three functions to start page layout in
subsequent patches when we move the layout setup into each individual
page.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:11 +0100
fb2c71fa
html: remove html_status()

This is now unused.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:10 +0100
fd00e71a
snapshot: don't reimplement cgit_print_error_page()

cgit_print_error_page() has the advantage that it sets a suitable HTTP
status code for the response.  Note that setting "mimetype" is redundant
here since it cannot have changed since being initialized in
cgit.c::prepare_context(), so we do not need to worry that
cgit_print_error_page() does not set it.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:09 +0100
58e827cb
snapshot: use cgit_print_error_page() for HTTP status codes

This is a bugfix as well as an improvement to the HTTP status code
handling since previously we would not print HTTP headers on any of
these code paths.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:08 +0100
e3e41e51
patch: use cgit_print_error_page() for HTTP status codes

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:07 +0100
9a06211d
blob: use cgit_print_error_page() to add HTTP headers

This is a bugfix as well as an improvement to the HTTP status code
handling since previously we would not print HTTP headers on any of
these code paths.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:06 +0100
048f195e
snapshot: use cgit_print_error_page() instead of html_status()

This provides a formatted error response rather than a simple HTTP
error.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:05 +0100
2b3e76a9
plain: use cgit_print_error_page() instead of html_status()

This provides a formatted error response rather than a simple HTTP
error.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:04 +0100
329381df
clone: use cgit_print_error_page() instead of html_status()

This provides a formatted error response rather than a simple HTTP
error.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:03 +0100
e9b71ae6
cgit: use cgit_print_error_page() where appropriate

These are more-or-less one-to-one translations but in the final hunk we
gain an HTTP error code where we used to send "200 OK", which is an
improvement.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:02 +0100
aec1204a
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>
John Keeping john@keeping.me.uk
Fri, 14 Aug 2015 12:47:01 +0100
aa12084f
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>
Christian Hesse mail@eworm.de
Fri, 14 Aug 2015 00:02:50 +0200
c543d7db
Makefile: make "git/config.mak.uname" inclusion optional

If we haven't got a "git" directory, it should still be possible to run
"make get-git", so we cannot include this file unconditionally.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 15:54:37 +0100
a360666d
ui-shared: show full date in tooltip if longer ago than max_relative

Commit caed6cb (ui-shared: show absolute time in tooltip for relative
dates, 2014-12-20) added a toolip when we show a relative time.

However, in some cases we show a short date (that is, the date but not
the time) if an event was sufficiently far in the past and that commit
did not update that case to add the same tooltip.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:24:34 +0100
b44dd95f
ui-shared: use common function in print_rel_date()

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:24:33 +0100
f03e3cb8
ui-shared: extract date formatting to a function

This will allow this code to be common with print_rel_date.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:24:32 +0100
0c4d7675
filter: don't use dlsym unnecessarily

We only need to hook write() if Lua filter's are in use.  If support has
been disabled, remove the dependency on dlsym().

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:20 +0100
7105a78b
ui-tree: use "sane" isgraph()

Git's git-compat-util.h defines a "sane ctype" that does not use locale
information and works with signed chars, but it does not include
isgraph() so we have included ctype.h ourselves.

However, this means we have to include a system header before
git-compat-util.h which may lead to the system defining some macros
(e.g. _FILE_OFFSET_BITS on Solaris) before git-compat-util.h redefines
them with a different value.  We cannot include ctype.h after
git-compat-util.h because we have defined many of its functions as
macros which causes a stream of compilation errors.

Defining our own "sane" isgraph() using Git's sane isprint() and
isspace() avoids all of these problems.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:19 +0100
e09574bd
cgit.h: move stdbool.h from ui-shared.h

Follow the Git policy of including system headers in only one place.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:18 +0100
43620cf6
cache.c: fix header order

git-compat-util.h may define values that affect how system headers are
interpreted, so move sys/sendfile.h after cgit.h (which includes
git-compat-util.h).

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:17 +0100
f2e8ca80
configfile.c: don't include system headers directly

git-compat-util.h may define various values that affect the
interpretation of system headers.  In most places we include cgit.h
first, which pulls in git-compat-util.h, but this file does not depend
on anything else in CGit, so use git-compat-util.h directly.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:16 +0100
157f544a
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>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:15 +0100
03931022
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>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:14 +0100
2ef4edee
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>
John Keeping john@keeping.me.uk
Thu, 13 Aug 2015 12:14:13 +0100
c0b59823
redirect: cleanliness
Jason A. Donenfeld Jason@zx2c4.com
Thu, 13 Aug 2015 11:38:56 +0200
622e64d5
redirect: be more careful for different cgi setups
Jason A. Donenfeld Jason@zx2c4.com
Thu, 13 Aug 2015 11:38:27 +0200
da1d4c77
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>
John Keeping john@keeping.me.uk
Wed, 12 Aug 2015 16:41:34 +0100
30304d81
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>
John Keeping john@keeping.me.uk
Wed, 12 Aug 2015 15:55:28 +0100
044e2d26
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>
John Keeping john@keeping.me.uk
Wed, 12 Aug 2015 15:34:48 +0100
2d386e22
t0110: Chain together using &&
Jason A. Donenfeld Jason@zx2c4.com
Wed, 12 Aug 2015 15:15:56 +0200
d7034806
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>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 12 Aug 2015 14:50:09 +0200
13c2d3df
filters: apply HTML escaping

http://www.w3.org/International/questions/qa-escapes#use
Lazaros Koromilas lostd@2f30.org
Wed, 15 Jul 2015 15:53:12 +0300
de83de27
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>
Christian Hesse mail@eworm.de
Tue, 28 Jul 2015 10:42:01 +0200
dc41a001
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>
Daniel Reichelt hacking@nachtgeist.net
Mon, 10 Aug 2015 09:45:48 +0200
121e6539
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>
John Keeping john@keeping.me.uk
Tue, 23 Dec 2014 14:40:44 +0000
2eb41c46
git: update to v2.4.1

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Thu, 14 May 2015 13:47:28 +0200
d1ddce90
ui-shared: allow remote refs in branch switcher

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 18 Mar 2015 18:08:48 +0100
84627609
git: update to v2.3.3

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 14 Mar 2015 17:21:42 +0100
cadbb699
Bump version
Jason A. Donenfeld Jason@zx2c4.com
Fri, 13 Mar 2015 16:22:11 +0100
db021a19
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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 05 Mar 2015 20:41:45 +0100
7511f4b4
filters: Add sample gentoo script
Jason A. Donenfeld Jason@zx2c4.com
Tue, 10 Mar 2015 02:21:31 +0100
f3ab1f17
cgit: remember to set up env vars before empty clone path
Jason A. Donenfeld Jason@zx2c4.com
Sun, 08 Mar 2015 13:08:04 +0100
8eef4589
ui-shared: currenturl should take into account leading slash
Jason A. Donenfeld Jason@zx2c4.com
Sun, 08 Mar 2015 12:34:07 +0100
438bac6f
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:27 +0000
80d52079
cache: don't use an integer as a NULL pointer

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:26 +0000
d34b9671
ui-shared: don't use an integer as a NULL pointer

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:25 +0000
94e5f212
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:24 +0000
bd9fb032
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:23 +0000
0f23d465
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:22 +0000
ad74669e
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:21 +0000
3fe509e1
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:20 +0000
eefd5e0a
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:19 +0000
812cd49e
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:18 +0000
12d3d4c3
Avoid signed bitfields

Bitfields are only defined for unsigned types.

Detected by sparse.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:17 +0000
e3d3fffd
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>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:16 +0000
5150b7c1
Makefile: add a target to run CGit through sparse

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 08 Mar 2015 16:32:15 +0000
97a91657
git: update to v2.3.2

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Sat, 07 Mar 2015 12:44:39 +0100
198d84a9
Bump version
Jason A. Donenfeld Jason@zx2c4.com
Thu, 05 Mar 2015 15:58:28 +0100
3cb8e762
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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 05 Mar 2015 12:58:12 +0100
4d8ed337
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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 05 Mar 2015 12:58:11 +0100
ecd6b723
simple-authentication.lua: tie secure cookies to field names
Jason A. Donenfeld Jason@zx2c4.com
Thu, 05 Mar 2015 15:45:25 +0100
bd24832c
cgit: show clone URLs for empty repo
Jason A. Donenfeld Jason@zx2c4.com
Thu, 05 Mar 2015 02:18:42 +0100
db9a70b1
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>
John Keeping john@keeping.me.uk
Tue, 03 Mar 2015 19:22:31 +0000
2e4a41e8
Make root handling sane again.
Jason A. Donenfeld Jason@zx2c4.com
Tue, 03 Mar 2015 17:23:40 +0100
6bcda2f7
ui-shared: Add current url helper function.
Jason A. Donenfeld Jason@zx2c4.com
Tue, 03 Mar 2015 17:18:42 +0100
db4b7354
ui-shared: keep filter repolist page in pagination
Jason A. Donenfeld Jason@zx2c4.com
Tue, 03 Mar 2015 17:13:52 +0100
c3473e8a
ui-repolist: use ctx.qry.url instead of rooturl, in case we're filtering
Jason A. Donenfeld Jason@zx2c4.com
Tue, 03 Mar 2015 17:06:48 +0100
e14eee9e
ui-repolist: use correct owner query link
Jason A. Donenfeld Jason@zx2c4.com
Tue, 03 Mar 2015 16:53:11 +0100
936295c4
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>
Lukas Fleischer cgit@cryptocrack.de
Tue, 03 Mar 2015 13:00:07 +0100
911d5742
git: update to v2.3.1

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 25 Feb 2015 09:14:13 +0100
5e3e665d
Bump verison
Jason A. Donenfeld Jason@zx2c4.com
Sun, 15 Feb 2015 22:12:12 +0100
36b1d789
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>
Christian Hesse mail@eworm.de
Wed, 11 Feb 2015 09:12:44 +0100
6e498de2
ui-clone.c: Fix off-by-one error in pack path

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 09 Feb 2015 12:27:44 +0100
b66b16ed
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>
Lukas Fleischer cgit@cryptocrack.de
Mon, 09 Feb 2015 07:25:00 +0100
7358f630
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>
Christian Hesse mail@eworm.de
Sat, 07 Feb 2015 14:18:28 +0100
1a9e5660
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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 05 Feb 2015 10:11:42 +0100
c58cec9d
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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 29 Jan 2015 12:52:49 +0100
1a2eeb94
Add Etags for snapshots
Janus ysangkok@gmail.com
Sat, 17 Jan 2015 14:54:31 +0100
c422b9b3
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>
John Keeping john@keeping.me.uk
Thu, 15 Jan 2015 22:18:14 +0000
ed7e3bc8
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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 15 Jan 2015 19:47:42 +0100
c641e0ab
git: update to v2.2.2

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 13 Jan 2015 08:53:56 +0100
d6c40507
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>
John Keeping john@keeping.me.uk
Mon, 29 Dec 2014 22:27:55 +0000
7552266a
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>
John Keeping john@keeping.me.uk
Sun, 28 Dec 2014 13:10:33 +0000
ce8f4902
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>
John Keeping john@keeping.me.uk
Sun, 28 Dec 2014 13:10:32 +0000
b1227300
Revert "git: use xz compressed archive for download"

This reverts commit a87c9d8a9779eab0499efd3c44e090a28c7d1cdf.

We want to make OpenBSD people happy.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 24 Dec 2014 12:50:11 +0100
6f9e8a96
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>
Lukas Fleischer cgit@cryptocrack.de
Wed, 24 Dec 2014 08:50:11 +0100
2159414a
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.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 19 Mar 2014 03:11:45 -0600
caed6cb2
ui-shared: show absolute time in tooltip for relative dates

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 20 Dec 2014 13:59:39 +0000
a87c9d8a
git: use xz compressed archive for download
Christian Hesse mail@eworm.de
Tue, 23 Dec 2014 19:14:07 -0700
62affc0e
match other common markdown file extensions
Chris Burroughs chris.burroughs@gmail.com
Thu, 17 Jul 2014 09:44:13 -0400
96ceb9a9
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.
Chris Burroughs chris.burroughs@gmail.com
Mon, 04 Aug 2014 09:23:08 -0400
3c53ebfb
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>
John Keeping john@keeping.me.uk
Fri, 01 Aug 2014 22:14:19 +0100
d31be4cc
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>
John Keeping john@keeping.me.uk
Fri, 01 Aug 2014 22:14:18 +0100
bbfa006e
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>
John Keeping john@keeping.me.uk
Fri, 01 Aug 2014 22:14:17 +0100
485b0992
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>
Lukas Fleischer cgit@cryptocrack.de
Sat, 13 Dec 2014 11:40:48 +0100
17838ec6
git: update to v2.2.1

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

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 19 Dec 2014 00:28:34 -0700
10c5680e
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.
Christian Hesse mail@eworm.de
Wed, 10 Sep 2014 11:24:07 +0200
ddfaef6b
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>
John Keeping john@keeping.me.uk
Sun, 05 Oct 2014 10:59:05 +0100
1830271c
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>
John Keeping john@keeping.me.uk
Sun, 05 Oct 2014 10:59:04 +0100
03f537f1
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>
John Keeping john@keeping.me.uk
Sun, 05 Oct 2014 10:59:03 +0100
eeddb5bc
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>
John Keeping john@keeping.me.uk
Sun, 05 Oct 2014 10:59:02 +0100
49f60777
git: update to v2.0.4

No CGit changes required.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 03 Aug 2014 15:51:42 +0100
9dd67272
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>
Lukas Fleischer cgit@cryptocrack.de
Sun, 27 Jul 2014 20:50:59 +0200
efa2879a
cgitrc.5: we mean a cgi response, not request
Jason A. Donenfeld Jason@zx2c4.com
Fri, 01 Aug 2014 17:37:27 +0200
2eea471a
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>
John Keeping john@keeping.me.uk
Sun, 27 Jul 2014 11:56:20 +0100
865afe0e
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>
John Keeping john@keeping.me.uk
Sun, 27 Jul 2014 11:56:19 +0100
93d8ef8f
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>
John Keeping john@keeping.me.uk
Sun, 27 Jul 2014 11:56:18 +0100
eeaffc33
Bump version.
Jason A. Donenfeld Jason@zx2c4.com
Mon, 30 Jun 2014 15:15:35 +0200
4b91269b
remove debug fprinf() calls that sneaked in with commit 79c985
Christian Hesse mail@eworm.de
Sun, 29 Jun 2014 18:52:16 +0200
390ffad0
git: update to 2.0.1

Everything works just bumping the version in Makefile and commit hash in
submodule. No code changes required.
Christian Hesse mail@eworm.de
Sat, 28 Jun 2014 16:04:17 +0200
2efb59ed
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>
John Keeping john@keeping.me.uk
Wed, 11 Jun 2014 21:01:50 +0100
4046e8ef
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>
John Keeping john@keeping.me.uk
Sat, 28 Jun 2014 15:55:06 +0200
79c985e1
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.
Christian Hesse mail@eworm.de
Thu, 29 May 2014 17:35:46 +0200
b431282c
remove trailing whitespaces from source files
Christian Hesse mail@eworm.de
Thu, 17 Apr 2014 11:55:46 +0200
dcb16f0d
git: update to 1.9.2

Everything works just bumping the version in Makefile and commit hash in
submodule. No code changes required.
Christian Hesse mail@eworm.de
Thu, 10 Apr 2014 05:34:34 +0200
10451797
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'"
Julian Maurice julian.maurice@biblibre.com
Fri, 28 Mar 2014 23:18:29 +0100
88b93113
Makefile: use more reliable git tarball mirror
Jason A. Donenfeld Jason@zx2c4.com
Thu, 20 Mar 2014 11:20:01 -0600
45315f84
git: update to 1.9.1

Everything works just bumping the version in Makefile and commit hash
in submodule. No code changes required.
Christian Hesse mail@eworm.de
Thu, 20 Mar 2014 14:41:16 +0100
e22e9854
filter: add libravatar email-filter lua script
Christian Hesse mail@eworm.de
Thu, 13 Mar 2014 11:55:49 +0100
f2fa9c56
Bump version.
Jason A. Donenfeld Jason@zx2c4.com
Fri, 28 Feb 2014 00:12:08 +0100
49306110
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>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 26 Feb 2014 16:57:15 +0100
3e9578e9
Remove unused parameter from cgit_print_snapshot()
Lukas Fleischer cgit@cryptocrack.de
Sat, 08 Feb 2014 14:37:29 +0100
e6749644
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.
Christian Hesse mail@eworm.de
Thu, 20 Feb 2014 20:48:45 +0100
2e8e9af1
Clean up cache documentation.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 21 Feb 2014 01:36:20 +0100
6ceba453
Skip cache slot when time-to-live is zero

If time-to-live is set to zero, we don't need to regenerate the cache
slots on every request. Instead, just skip the caching process and
immediately provide the dynamically generated version of the page.
Setting time-to-live to zero is useful when you want to disable caching
for certain pages.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Thu, 20 Feb 2014 20:59:22 +0100
8033dc01
git: Update to 1.9.0

No code changes required, just bump the submodule and Makefile versions.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Thu, 20 Feb 2014 20:58:13 +0100
8acfa51a
Makefile: suppress pkg-config error

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 20 Feb 2014 20:06:29 +0100
a3722ec3
Add a cache-snapshot-ttl configuration variable

This can be used to specify the TTL for snapshots. Snapshots are usually
static and do not ever change. On the other hand, tarball generation is
CPU intensive.

One use case of this setting (apart from increasing the lifetime of
snapshot cache slots) is caching of snapshots while disabling the cache
for static/dynamic HTML pages (by setting TTL to zero for everything
except for snapshot requests).

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 05 Feb 2014 10:23:58 +0100
7e1c0ed2
diffstat: do not rely on uninitialized data

Right now if you visit:
<http://git.zx2c4.com/systemd/diff/src/udev/udev-builtin-input_id.c?id=bcfce235>
you'll see that if you reload the page a few times, a bunch of times the
diffstat comes out with no lines being shown or changed. I'm not
currently sure what the cause of this is, but I suspect it might have to
do with this uninitialized data.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 20 Feb 2014 19:48:24 +0100
e8cacb59
gen-version.sh: check if git is available before trying to call it

Some people may clone the cgit repository and compile within a sandbox
or on another machine where git is not necessarily installed. When it
happens, cgit is getting compiled with an empty version number.

This commit fixes this.
Fabien C t74jgwb88tli9ch@jetable.org
Sat, 01 Feb 2014 16:07:46 +0100
aa6d5b10
simple-authentication: style

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 23 Jan 2014 00:58:07 +0100
44ccae42
makefile: use LUA_PKGCONFIG to set Lua implementation

This breaks compat with the previous LUA_IMPLEMENTATION but gives more
flexibility in that user can specify the pkg-config package name
directly.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Natanael Copa ncopa@alpinelinux.org
Wed, 22 Jan 2014 13:15:08 +0100
f759cc0f
tests: only do lua tests if lua is compiled-in

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 20 Jan 2014 13:11:10 +0100
6a156334
cgit: add --version argument for printing info

We need this to do runtime tests for make test.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 20 Jan 2014 13:05:08 +0100
d3581b58
cache: use sendfile() instead of a pair of read() + write()

sendfile() does the same job and avoids to copy the content into userland
and back. One has to define NO_SENDFILE in case the OS (kernel / libc)
does not supported. It is disabled by default on non-linux environemnts.
According to the glibc, sendfile64() was added in Linux 2.4 (so it has
been there for a while) but after browsing over the mapage of FreeBSD's I
noticed that the prototype is little different.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Sebastian Andrzej Siewior sebastian@breakpoint.cc
Sat, 18 Jan 2014 21:24:58 +0100
ea7210be
README: document pkg-config for luajit

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 18 Jan 2014 00:45:01 +0100
6952f164
makefile: bump version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 16:09:16 +0100
bdbe03af
mailmap: source before lighttpd

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 16:04:12 +0100
bb3cc0d9
ui-shared: do not allow negative minutes

Do to timestamp differences, sometimes cgit would should "-0 min", which
doesn't make any sense.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 15:41:41 +0100
9dde6d38
auth: document tweakables in lua script

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 15:34:44 +0100
a2b6b371
repolist: make owner clickable to search

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 16 Jan 2014 22:54:23 +0100
3cbbb8ea
ui-shared: move about tab all the way to the left

There were no objections (at the time of committing this):
   http://lists.zx2c4.com/pipermail/cgit/2013-May/001393.html
   http://lists.zx2c4.com/pipermail/cgit/2014-January/001904.html

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 13:53:37 +0100
9786f461
filter: don't forget to reap the auth filter

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 13:53:02 +0100
9999b0a3
cgit.c: free tmp variable

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 17 Jan 2014 00:48:17 +0100
f60ffa14
Switch to exclusively using global ctx

Drop the context parameter from the following functions (and all static
helpers used by them) and use the global context instead:

* cgit_print_http_headers()
* cgit_print_docstart()
* cgit_print_pageheader()

Remove context parameter from all commands

Drop the context parameter from the following functions (and all static
helpers used by them) and use the global context instead:

* cgit_get_cmd()
* All cgit command functions.
* cgit_clone_info()
* cgit_clone_objects()
* cgit_clone_head()
* cgit_print_plain()
* cgit_show_stats()

In initialization routines, use the global context variable instead of
passing a pointer around locally.

Remove callback data parameter for cache slots

This is no longer needed since the context is always read from the
global context variable.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 15 Jan 2014 21:53:15 +0100
a431326e
auth: have cgit calculate login address

This way we're sure to use virtual root, or any other strangeness
encountered.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 16 Jan 2014 23:21:54 +0100
df00ab10
auth: lua string comparisons are time invariant

By default, strings are compared by hash, so we can remove this comment.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 16 Jan 2014 19:47:35 +0100
b826537c
authentication: use hidden form instead of referer

This also gives us some CSRF protection. Note that we make use of the
hmac to protect the redirect value.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 16 Jan 2014 11:39:17 +0100
d6e9200c
auth: add basic authentication filter framework

This leverages the new lua support. See
filters/simple-authentication.lua for explaination of how this works.
There is also additional documentation in cgitrc.5.txt.

Though this is a cookie-based approach, cgit's caching mechanism is
preserved for authenticated pages.

Very plugable and extendable depending on user needs.

The sample script uses an HMAC-SHA1 based cookie to store the
currently logged in user, with an expiration date.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 21:49:31 +0100
3741254a
t0111: Additions and fixes

* Rename the capitalize-* filters to dump.* since they also dump the
  arguments.

* Add full argument validation to the email filters.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 15 Jan 2014 23:11:19 +0100
2a7dd4bf
parsing.c: Remove leading space from committer

This did not really break anything in the past since spaces are ignored
when rendering HTML. Remove the preceding space anyway to prevent from
potential future problems.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 15 Jan 2014 23:09:08 +0100
c01fb69f
Add .mailmap

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 14 Jan 2014 21:35:00 +0100
caf557a2
t0111: Add basic tests for Lua filters

* Validate the email filter by manipulating stdin. Additional checks for
  all the arguments can be added in a later patch.

* Add the exec prefix to all informational messages.

* Rename the filter repository to filter-exec. The Git repository itself
  is not renamed since it can be shared amongst all filter types.

* In the filter checks, check whether all arguments are passed properly
  instead of validating the buffer/stdin only.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 14 Jan 2014 22:25:45 +0100
8ae1d8b8
email-gravatar: fix html syntax issues

an attribute value specification must be an attribute value literal
unless SHORTTAG YES is specified
Christian Hesse mail@eworm.de
Wed, 15 Jan 2014 13:39:54 +0100
5bda21fa
email-gravatar: do not scale icons up

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 18:57:36 +0100
6ca734da
filter: allow returning exit code from filter

Filters can now indicate a status back to cgit by means of the exit code
for exec, or the return value from close for Lua.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 18:07:23 +0100
ce56d89a
tests/: Add t0111-filter.sh

This adds basic tests for all types of exec filters.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 14 Jan 2014 12:01:06 +0100
1167dbb9
email-gravatar: fix html syntax issues

* make ampersand a html entity
* add required alt attribute
* add required img end tag
Christian Hesse mail@eworm.de
Tue, 14 Jan 2014 12:01:58 +0100
46176eca
email-gravatar.py: fix UTF-8
Christian Hesse mail@eworm.de
Tue, 14 Jan 2014 11:11:23 +0100
50287e79
email-gravatar.lua: fix for lua 5.2
Christian Hesse mail@eworm.de
Tue, 14 Jan 2014 11:32:54 +0100
a9a7f682
makefile: only display lua message once

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 13:47:28 +0100
027e88a1
README: document lua makefile flags

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 03:48:23 +0100
70546a34
cgitrc.5.txt: Fix documentation of the snapshot mask

Mention that the snapshot setting only specifies the formats that links
are generated for and not the set of formats that are accessible via
HTTP.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 14 Jan 2014 00:49:48 +0100
3488d124
makefile: auto-detect presence of various Lua, bsd

We favor LuaJIT over Lua. We disable Lua if neither can be found. We
error out if a particular Lua is specified via LUA_IMPLEMENTATION=JIT or
LUA_IMPLEMENTATION=VANILLA, but cannot be found. We print a status
message depending on what happens.

Also, we do not link against libdl on the BSDs, since they include it as
part of libc.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 01:50:31 +0100
d3c0370a
filter: style tweaks

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2014 23:54:28 +0100
786609bd
filter: add page source to email filter

Since the email filter is called from lots of places, the script might
benefit from knowing the origin. That way it can modify its contents
and/or size depending.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2014 16:24:40 +0100
e942a162
filter: add gravatar scripts

The lua one is hugely faster than the python one, but both are included
for comparison.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 10 Jan 2014 06:17:09 +0100
a5e15537
filter: add support for email filter

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2014 04:04:52 +0100
800380dd
filter: return on null filter from open and close

So that we don't have to include the if(filter) open_filter(filter)
block everywhere, we introduce the guard in the function itself. This
should simplify quite a bit of code.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2014 03:56:50 +0100
f43b228d
filter: add lua support

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2014 14:18:51 +0100
e83b51b4
filter: basic write hooking infrastructure

Filters can now call hook_write and unhook_write if they want to
redirect writing to stdout to a different function. This saves us from
potential file descriptor pipes and other less efficient mechanisms.

We do this instead of replacing the call in html_raw because some places
stdlib's printf functions are used (ui-patch or within git itself),
which has its own internal buffering, which makes it difficult to
interlace our function calls. So, we dlsym libc's write and then
override it in the link stage.

While we're at it, we move considerations of argument count into the
generic new filter handler.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 Jan 2014 14:16:18 +0100
d750c7a2
filter: allow for cleanup hook for filter types

At some point, we're going to want to do lazy deallocation of filters.
For example, if we implement lua, we'll want to load the lua runtime
once for each filter, even if that filter is called many times.
Similarly, for persistent exec filters, we'll want to load it once,
despite many open_filter and close_filter calls, and only reap the child
process at the end of the cgit process. For this reason, we add here a
cleanup function that is called at the end of cgit's main().

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 12 Jan 2014 20:58:21 +0100
4bb87cbf
filter: introduce "filter type" prefix

This allows different filter implementations to be specified in the
configuration file.  Currently only "exec" is supported, but it may now
be specified either with or without the "exec:" prefix.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 17:13:53 +0000
7bd90b80
filter: add interface layer

Change the existing cgit_{open,close,fprintf}_filter functions to
delegate to filter-specific implementations accessed via function
pointers on the cgit_filter object.

We treat the "exec" filter type slightly specially here by putting its
structure definition in the header file and providing an "init" function
to set up the function pointers.  This is required so that the
ui-snapshot.c code that applies a compression filter can continue to use
the filter interface to do so.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 17:13:52 +0000
632efb25
filter: add fprintf_filter function

This stops the code in cgit.c::print_repo needing to inspect the
cgit_filter structure, meaning that we can abstract out different filter
types that will have different fields that need to be printed.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 17:13:51 +0000
ed3497b0
authors: specify maintainers

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 14 Jan 2014 01:59:28 +0100
ceffeb5d
filters: Improved syntax-highlighting.py

- Switched back to python2 according to a problem in pygments with python3.
  With the next release of pygments this problem should be fixed.
  Issue see here:
  https://bitbucket.org/birkenfeld/pygments-main/issue/901/problems-with-python3
- Just read the stdin, decode it to utf-8 and ignore unknown signs. This ensures
  that even destroyed files do not cause any errors in the filter.
- Improved language guessing:
  -> At first use guess_lexer_for_filename for a better detection of the used
     programming languages (even mixed cases will be detected, e.g. php + html).
  -> If nothing was found look if there is a shebang and use guess_lexer.
  -> As default/fallback choose TextLexer.

Signed-off-by: Stefan Tatschner <stefan@sevenbyte.org>
Stefan Tatschner stefan@sevenbyte.org
Mon, 13 Jan 2014 22:10:45 +0100
a52aaa90
tests: add CGIT_TEST_OPTS variable to Makefile

This allows running the entire test suite with a set of command-line
options.  For example:

	make test CGIT_TEST_OPTS=--valgrind

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 19:46:42 +0000
1de65911
ui-repolist: HTML-escape cgit_rooturl() response

This is for consistency with other callers.  The value returned from
cgit_rooturl is not guaranteed to be HTML-safe.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 19:45:17 +0000
a45030f8
ui-shared: URL-escape script_name

As far as I know, there is no requirement that $SCRIPT_NAME contain only
URL-safe characters, so we need to make sure that any special characters
are escaped.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 19:45:16 +0000
d1a6ece4
ui-refs: escape HTML chars in author and tagger names

Everywhere else we use html_txt to escape any special characters in
these variables.  Do so here as well.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 19:45:15 +0000
3d8a6507
filter: pass extra arguments via cgit_open_filter

This avoids poking into the filter data structure at various points in
the code.  We rely on the fact that the number of arguments is fixed
based on the filter type (set in cgit_new_filter) and that the call
sites all know which filter type they're using.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 17:13:50 +0000
da218fcd
ui-snapshot: set unused cgit_filter fields to zero

By switching the assignment of fields in the cgit_filter structure to
use designated initializers, the compiler will initialize all other
fields to their default value.  This will be needed when we add the
extra_args field in the next patch.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 17:13:49 +0000
fd31aa69
html: remove redundant htmlfd variable

This is never changed from STDOUT_FILENO, so just use that value
directly.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 17:13:48 +0000
1b1974c4
tests: add Valgrind support

Now running tests with the "--valgrind" option will run cgit under
Valgrind instead of all Git commands.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 08 Apr 2013 20:12:38 +0100
382ecf15
cache: don't leave cache_slot fields uninitialized

Valgrind says:

==18344== Conditional jump or move depends on uninitialised value(s)
==18344==    at 0x406C83: open_slot (cache.c:63)
==18344==    by 0x407478: cache_ls (cache.c:403)
==18344==    by 0x404C9A: process_request (cgit.c:639)
==18344==    by 0x406BD2: fill_slot (cache.c:190)
==18344==    by 0x4071A0: cache_process (cache.c:284)
==18344==    by 0x404461: main (cgit.c:952)
==18344==  Uninitialised value was created by a stack allocation
==18344==    at 0x40738B: cache_ls (cache.c:375)

This is caused by the keylen field being used to calculate whether or
not a slot is matched.  We never then check the value of this and the
length of data read depends on the key length read from the file so this
isn't dangerous, but it's nice to avoid branching based on uninitialized
data.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 12 Jan 2014 16:49:40 +0000
3eae4069
filter: split filter functions into their own file

A first step for more interesting things.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 10 Jan 2014 05:19:05 +0100
b67ea0c0
filter: make exit status local

It's only used in one place, and not useful to have around since
close_filter will die() if exit_status isn't what it expects, anyway. So
this is best as just a local variable instead of as part of the struct.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 10 Jan 2014 03:51:02 +0100
d01a6eec
parsing: fix header typo
Jason A. Donenfeld Jason@zx2c4.com
Fri, 10 Jan 2014 04:59:34 +0100
c96becc1
cgit.c: Fix comment on bit mask hack

* Formatting and spelling fixes.

* A bit mask with the size of one byte only allows for storing 8 (not
  255!) different flags.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 10 Jan 2014 14:55:31 +0100
441e7485
cgit.c: Use "else" for mutually exclusive branches

When parsing command line arguments, no pair of command line options can
ever match simultaneously. Use "else if" blocks to reflect this. This
change improves both readability and speed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 10 Jan 2014 14:55:30 +0100
e7116796
ui-snapshot.c: Do not reinvent suffixcmp()

Use suffixcmp() from Git instead of reimplementing it. This is a
preparation for moving to ends_with() in Git 1.8.6.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 10 Jan 2014 12:44:38 +0100
f04b8d5c
Refactor cgit_parse_snapshots_mask()

Use Git string lists instead of str{spn,cspn,ncmp}() magic. This
significantly improves readability.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 10 Jan 2014 12:44:37 +0100
2abce430
Disallow use of undocumented snapshot delimiters

Since the introduction of selective snapshot format configuration in
dc3c9b5 (allow selective enabling of snapshots, 2007-07-21), we allowed
seven different delimiters for snapshot formats, while the documentation
has always been clear about spaces being the only valid delimiter:

    The value is a space-separated list of zero or more of the values
    "tar", "tar.gz", "tar.bz2", "tar.xz" and "zip".

Supporting the undocumented delimiters makes the code unnecessarily
complex. Remove them.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 10 Jan 2014 12:44:36 +0100
36bdb217
Replace most uses of strncmp() with prefixcmp()

This is a preparation for replacing all prefix checks with either
strip_prefix() or starts_with() when Git 1.8.6 is released.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 10 Jan 2014 12:44:35 +0100
d523dacc
README: Fix dependencies

* Remove the dependency on Git (which can be obtained automatically when
  building, using either the Git submodule or `make get-git`).

* Use proper upstream names of dependencies.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Thu, 09 Jan 2014 19:44:27 +0100
e2416259
README: Spelling and formatting fixes

* Several small spelling and capitalization fixes.

* Use consistent and better-looking formatting that is compatible with
  AsciiDoc (and partly compatible with RST).

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 08 Jan 2014 19:45:29 +0100
b6da53dd
Fix UTF-8 with syntax-highlighting.py

Previously the script tried to encode output from Pygments with
the ASCII codec, which failed.

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
Přemysl Janouch p.janouch@gmail.com
Wed, 11 Sep 2013 20:10:12 +0200
4f6fb32f
Add a suggestion to the manpage

So that people wishing to use "enable-http-clone" don't have to find
out the correct settings on their own.

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
Přemysl Janouch p.janouch@gmail.com
Wed, 11 Sep 2013 20:10:14 +0200
17e6a2af
Fix the example configuration

"enable-git-clone" doesn't exist, replaced with "enable-http-clone".

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
Přemysl Janouch p.janouch@gmail.com
Wed, 11 Sep 2013 20:10:13 +0200
f1fb521a
Fix about-formatting.sh

dash failed to parse the script.

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
Přemysl Janouch p.janouch@gmail.com
Wed, 11 Sep 2013 20:10:11 +0200
88028ad5
Fix some spelling errors

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
Přemysl Janouch p.janouch@gmail.com
Wed, 11 Sep 2013 20:10:10 +0200
09a28d76
filters: highlight.sh: add css comments for highlight 2.6 and 3.8

v2: add highlight 3.13 as present on Fedora 19

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Sat, 09 Nov 2013 20:34:55 +0100
d350d34d
Add AUTHORS file

Contains a list of contributors with more than 20 patches, to be updated
regularly.

Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
Lukas Fleischer cgit@crytocrack.de
Wed, 08 Jan 2014 15:18:03 +0100
f7f26f88
Update copyright information

* Name "cgit Development Team" as copyright holder to avoid listing
  every single developer.

* Update copyright ranges.

Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
Lukas Fleischer cgit@crytocrack.de
Wed, 08 Jan 2014 15:10:49 +0100
3cebf683
git: update to 1.8.5

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

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Christian Hesse mail@eworm.de
Thu, 28 Nov 2013 00:19:50 +0100
4468ec1b
Reduce line number bloat, fix hover effect

Currently line numbers look like (for blob view and sdiff respectively):

    <a class='no' id='n68' name='n68' href='#n68'>68</a>
    <td class='lineno'><a class='no' href='...#n1' id='n1' name='n1'>1</a></td>

name=".." is unnecessary if the id attribute is set (this even applies
to IE6), so drop it. (aside, in HTML5, the name attribute is gone.)

The line number links can be selected through their parent classes, no
need for another class "no", so drop it too.

For a file with 2000 lines, this yields a saving of 40% (29% gzipped).

While at it, fix the hover effect of line numbers: now the line number
get a black background as was intended.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Peter Wu lekensteyn@gmail.com
Thu, 03 Oct 2013 12:17:23 +0200
407f71cc
plain: don't append charset for binary MIME types

When outputting the Content-Type HTTP header we print the MIME type and
then append "; charset=<charset>" if the charset variable is non-null.

We don't want a charset when we have selected "application/octet-stream"
or when the user has specified a custom MIME type, since they may have
specified their own charset.  To avoid this, make sure we set the page's
charset to NULL in ui-plain before we generate the HTTP headers.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
John Keeping john@keeping.me.uk
Sun, 06 Oct 2013 12:14:41 +0100
d76c438e
ui-log.c: Several simplifications

* Use argv_array_pushf() for inserting formatted strings.
* Remove unneeded static strings.
* Replace "if" by "else if" for readability and speed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 22 Nov 2013 13:30:58 +0100
9973ef02
Use argv_array in place of vector

Instead of using our own vector implementation, use argv_array from Git
which has been specifically designed for dynamic size argv arrays.

Drop vector.h and vector.c which are no longer needed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 22 Nov 2013 13:24:52 +0100
e21da6c2
ui-stats.c: Remove unused macro

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 22 Nov 2013 09:50:17 +0100
f7db9b5e
scan-tree.c: Remove unused macro

This is no longer needed since commit fb3655df (use struct strbuf
instead of static buffers, 2013-04-06).

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 22 Nov 2013 09:49:31 +0100
d181d659
ui-shared: Drop filepair_cb_raw() and helper

Remove filepair_cb_raw() and all related functions. These are no longer
needed. We now use Git's internal functions for raw diff formatting
everywhere.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 27 Aug 2013 10:40:51 +0200
2da46fe5
ui-diff: Use diff_tree_sha1() for raw diff formatting

Use Git's internal diff_tree_sha1() function for the /rawdiff/ command
instead of trying to recreate this functionality.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 27 Aug 2013 10:40:50 +0200
d93cebaa
tests/: Add t0110-rawdiff.sh

This adds some basic tests for the /rawdiff/ command.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 26 Aug 2013 20:56:55 +0200
5a886272
t0108: Add tests for revision ranges

Add tests to check whether generating multiple patches at once works.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 26 Aug 2013 20:38:35 +0200
b5b1f071
t0108: Compare output with git-format-patch(1)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 26 Aug 2013 20:38:34 +0200
84085859
ui-patch.c: Add additional newline after each patch

For consistency with git-format-patch(1).

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 26 Aug 2013 20:38:33 +0200
334aed8a
ui-patch.c: Fix signature delimiter

Add a missing space after the "--" marker that introduces the patch
signature.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 26 Aug 2013 20:38:32 +0200
370535fc
t0108: Avoid unnecessary fork()

Use `git rev-list --max-parents=0 HEAD` instead of `git rev-list HEAD |
tail -1` to get the root commit. This works since Git 1.7.4.2.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 26 Aug 2013 20:38:31 +0200
d62e71a0
git: update to 1.8.4

No code changes required, just bump the submodule and makefile versions.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 24 Aug 2013 00:28:39 +0100
735c7f07
ui-patch.c: Fix formatting for merge commits

Add max_parents = 1 to the revision walk in order to make sure we do not
include the footer signature twice for merge commits.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Thu, 22 Aug 2013 14:48:47 +0200
4e00d338
ui-patch: Rename variables

Rename parameters and local variables to match those from ui-diff. Also,
convert a "char *" to "const char *".

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 20 Aug 2013 18:56:15 +0200
750f6462
Allow for creating patch series

This allows for specifying a revision range using the id2 parameter of
/patch/. The output that is produced is similar to

    $ git format-patch --stdout id2..id

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 20 Aug 2013 18:56:14 +0200
455b5987
ui-patch.c: Use log_tree_commit() to generate diffs

Instead of using our own formatting, use log_tree_commit() from Git to
create patches. This removes unnecessary duplicate code and also fixes a
bug with e-mail address formatting that existed in our own
implementation.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 20 Aug 2013 18:56:13 +0200
01db0837
ui-diff: Check the return value of get_sha1()

Sync with what we do everywhere else and check the return value of
get_sha1() instead of calling sha1_object_info() to validate the object.
Note that we later call lookup_commit_reference(), which checks that
both SHA1 values refer to commits, anyway.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 20 Aug 2013 18:56:12 +0200
445f6ae8
cmd.c: Add a "rawdiff" command

This can be used to generate raw diffs between arbitrary revisions using
something like

     /rawdiff/?id=v0.9&id2=v0.9.1

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 14 Aug 2013 10:50:33 +0200
9003cc17
Allow for creating raw diffs with cgit_print_diff()

This adds a parameter to cgit_print_diff() to create raw diffs, using
the same format as `git diff <commit>`.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 14 Aug 2013 10:50:32 +0200
747b035d
Extract filepair_cb from ui-patch.c

Move filepair_cb() from ui-patch.c to ui-shared.c and rename it to
filepair_cb_raw(). This callback will be used in ui-diff.c in a
follow-up patch.

Note that it is not straightforward to extract filepair_cb() from
ui-diff.c which is why it is not done here as well.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 14 Aug 2013 10:50:31 +0200
cf152604
Fix silly spelling error.
Jason A. Donenfeld Jason@zx2c4.com
Fri, 16 Aug 2013 13:15:17 -0600
86e309fc
Fix section-from-path > 1

When having found the first path separator occurrence at position i, we
invoked strchr() on the same position i in subsequent iterations
resulting in the same path separator being returned by strchr() over and
over again. Increase the position by one to skip the occurrence that has
just been found and advance to the next separator.

Reported-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 28 Jun 2013 08:58:14 +0000
1a194aa2
Makefile: Change default prefix to "/usr/local"

Locally installed packages are usually installed to /usr/local.
Packagers can use `make prefix=/usr` to get back the old behavior.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 18 Jun 2013 12:42:09 +0000
50e70d32
Use strbuf for reading configuration files

Use struct strbuf from Git instead of fixed-size buffers to remove the
limit on the length of configuration file lines and refactor
read_config_line() to improve readability.

Note that this also fixes a buffer overflow that existed with the
original fixed-size buffer implementation.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 04 Jun 2013 14:47:53 +0000
820df9c6
add a note about generating agefile in hook
Christian Hesse mail@eworm.de
Mon, 22 Jul 2013 09:13:39 +0200
00e3a3ec
cache: id means static, even if head is specified too

Pages like /commit?h=wip&id=8a335ce618ba77fbf05148d6f8be17bd48ba4340
were being marked as dynamic, because of h=wip, when it should be
static, because of id=.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 28 May 2013 16:43:02 +0200
61ff1006
cache: document negative ttls and add about ttl

We've long supported negative ttls, for infinite cache, except the
documentation incorrectly showed one of our defaults as being 5 and not
-1. As well, with a negative ttl, we were actually making the HTTP
expired header go backwards. This changes it to go ahead ten years
instead.

Further, we add an cache-about-ttl option to set a different ttl for
about pages, which are now increasingly being filtered through markdown
or just sent statically anyway.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 28 May 2013 16:33:30 +0200
23debef6
robots.txt: disallow access to snapshots

My dmesg is filled with the oom killer bringing down processes while the
Bingbot downloads every snapshot for every commit of the Linux kernel in
tar.xz format. Sure, I should be running with memory limits, and now I'm
using cgroups, but a more general solution is to prevent crawlers from
wasting resources like that in the first place.

Suggested-by: Natanael Copa <ncopa@alpinelinux.org>
Suggested-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 28 May 2013 14:17:00 +0200
830eb6f6
use favicon by default
Christian Hesse mail@eworm.de
Mon, 22 Jul 2013 08:56:50 +0200
52c926ca
Add favicon

This adds a favicon to cgit. It is not enabled by default, though.
The file contains two icons, 16x16 and 32x32 pixels, optimized for size.
Christian Hesse mail@eworm.de
Wed, 29 May 2013 10:16:06 +0200
7fb12a8e
ui-summary: do not free ref

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 28 May 2013 09:31:45 +0200
6d6f8bde
filters: toggle perl utf8 situation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 28 May 2013 07:55:40 +0200
989d2513
CGIT-0.9.2

Features:
- update to git v1.8.3.
- expanded set of default filters to include markdown, restructuredtext, and
  man pages.
- better sample configuration file in man page.
- "readme" may now be specified multiple times, and cgit will choose the first
  one it finds.
- "readme" no longer needs a branch name. If prefixed with simply ":" it will
  use the default branch.
- "branch-sort" allowing branches to be sorted either by "age" or "name", for
  kernel.org.
- "enable-index-owner" allowing the owner column to be disabled in the index
  page.
- print submodule revision next to submodule link.
- integrate more closely with git apis, such as strbuf.
- rely on git test harness and git makefiles.
- more robust test suite.
- more rebust makefile dependency accounting.
- pager navigation is now unordered list.
- span tag wraps commit directions.

Behavior changes:
- HOME is no longer passed as an environment variable to any filter api
  scripts.
- "about-filter" now receives the filename being filtered as argv[1]. This may
  disrupt existing scripts, so adjust accordingly.
- gitconfig and gitattributes are no longer loaded from any system directories
  or home directories.

Security:
- CVE-2013-2117: disallow directory traversal when readme is set to filesystem
  path.

Bug fixes:
- ssdiff now correctly manages tab expansion.
- support unannotated tags in http git clone.
- lots of cleanups of global variables and memory leaks.
- do not rely on gettext/libintl.
- better C standard compliance.
- make several functions and variables static.
- improved constification.
- remove unused functions.
- fix colspan values to correct width.
- fix out-of-bounds memory accesses with virtual_root="".
- cache repo config more precisely.
- die when write fails.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 27 May 2013 22:00:13 +0200
cd42ded9
README: add trailing slash to homepage

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 27 May 2013 21:56:57 +0200
d6d3dbc8
cgitrc.5: improve example config

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 27 May 2013 21:47:02 +0200
8149be21
filters: import more modern scripts

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 27 May 2013 21:39:43 +0200
dcbc0438
readme: use string_list instead of space deliminations

Now this is possible in cgitrc -

readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install

Suggested-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 26 May 2013 15:20:02 +0200
fe36f84d
ui-summary: Disallow directory traversal

Using the url= query string, it was possible request arbitrary files
from the filesystem if the readme for a given page was set to a
filesystem file. The following request would return my /etc/passwd file:

http://git.zx2c4.com/?url=/somerepo/about/../../../../etc/passwd
http://data.zx2c4.com/cgit-directory-traversal.png

This fix uses realpath(3) to canonicalize all paths, and then compares
the base components.

This fix introduces a subtle timing attack, whereby a client can check
whether or not strstr is called using timing measurements in order
to determine if a given file exists on the filesystem.

This fix also does not account for filesystem race conditions (TOCTOU)
in resolving symlinks.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 19:47:15 +0200
2a1ead3e
cgitrc.5: information on directory traversal and multiple readme files

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 20:30:57 +0200
cd4c77d9
readme: Accept multiple candidates and test them.

The readme variable may now contain multiple space deliminated entries,
which per usual are either a filepath or a git ref filepath. If multiple
are specified, cgit will now select the first one in the list that
exists. This is to make it easier to specify multiple default readme
types in the main cgitrc file and have them automatically get applied to
each repo based on what exists.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 16:32:37 +0200
c0dfaf1c
ui-summary: Pass filename to about-filter

This gives the about-filter API the same semantics as source-filter,
where the filter receives the filename so it can decide what to do next
with it.

While we're at it, plug a memory leak.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 14:50:19 +0200
3cb5d86d
ui-summary: Use default branch for readme if : prefix

If the readme value begins with ":", and has no specified branch before
it, use the repository's default branch.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 14:19:10 +0200
03eb76df
cgit.c: Do not reset HOME after unsetting it.

The number of odd cases in which git will try to read config is far too
great to keep putting a bandaid over each one, so we'll just unset it.

If it turns out that scripts really liked to know about $HOME, we can
always reset it in the filter forks.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 19:25:56 +0200
5a4156ef
cgit.c: sync repo config printing with struct cgit_repo

We've now added quite a few config keys for repositories, but we've
forgotten to update the printing of it for cache files. Synchronize the
two.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sat, 25 May 2013 14:05:06 +0200
0499e88c
git: update to 1.8.3

No changes required, just bump the submodule and Makefile versions.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 25 May 2013 11:19:00 +0100
f32a2da6
cache.c: cache ls_cache output properly

By using the standard library's printf, cache_ls does not redirect its
output to the cache when we change the process' stdout file descriptor
to point to the cache file.  Fix this by using "htmlf" in the same way
that we do for writing HTTP headers.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 18:46:39 +0100
75bfec64
tests: introduce strip_header() helper function

This means that we can avoid hardcoding the number of headers we expect
CGit to generate in test cases and simply remove whatever headers happen
to by there when we are checking body content.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 18:46:38 +0100
1e9f1ee6
shared.c: use die_errno() where appropriate

This replaces some code that is re-implementing die_errno by just
calling the function.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 16:21:36 +0100
1fec7cd6
html.c: die when write fails

If we fail to write HTML output once, there's no point carrying on so
just write a failure message once and die.  By using Git's die_errno
function we also let the user know in what way the write failed.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 15:57:03 +0100
927060c5
ui-log: add <span/> around commit decorations

This helps projects that have a large number of tags to display them all
using custom CSS.

The default stylesheet has not been updated since what is useful for
projects with a lot of tags is not the same as what is useful for
projects with only a small number of decorations per commit.

Suggested-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 15:54:49 +0100
c2b79dd8
Makefile: fix parallel "make test"

When building the "test" target we depend on both cgit and building the
Git tools.  By doing this with two targets we end up running make in the
git/ directory twice, concurrently if using parallel make, which causes
us to build more than we need and potentially builds incorrectly if
multi-step build-then-move operations overlap.

Fix this by instead calling back into the makefile so that we alter the
"cgit" target to also build the Git tools.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 15:17:08 +0100
f75900b0
cache.c: fix cache_ls

Commit fb3655d (use struct strbuf instead of static buffers, 2013-04-06)
broke the logic in cache.c::cache_ls by failing to set slot->cache_name
before calling open_slot.

While fixing this, also free the strbufs added by that commit once we're
done with them.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 18 May 2013 18:28:14 +0100
7966fd9b
t0109: "function" is a bash-ism

We try to stick to POSIX shell in the tests but a "function" keyword has
found its way into t0109.  Remove it.

This makes the tests work with dash again.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 09 May 2013 19:40:58 +0100
72f8991c
New mailing list.
Jason A. Donenfeld Jason@zx2c4.com
Mon, 13 May 2013 14:00:50 +0200
8bf4a046
ui-snapshot: do not access $HOME

It's a bit tedious to have to do this here too. If we encounter other
issues with $HOME down the line, I'll look into adding some nice utility
functions to handle this, or perhaps giving up on the hope that we could
keep $HOME defined for scripts.

This commit additionally adds a test case, should the issue surface
again.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 30 Apr 2013 12:27:41 +0200
8d07ad33
t0001: validate Git -rcN version numbers correctly

When creating the GIT-VERSION-FILE that we use to test that the version
of Git in git/ is the same as in the CGit Makefile, Git applies the
transform "s/-/./g" to the version string.  This doesn't affect released
versions but does change RC version numbers such as 1.8.3-rc0.

While CGit should only refer to a released Git version in general, it is
useful to developers who want to test upcoming Git releases if the tests
do work with RCs, so change t0001 to apply the same transform to our
Makefile version before comparing it to the contents of
GIT-VERSION-FILE.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 27 Apr 2013 10:48:56 +0100
83115075
git: update to 1.8.2.2

No changes required, just bump the submodule and Makefile version.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 27 Apr 2013 10:20:16 +0100
9a725f4f
scan-tree: fix regression in section-from-path=-1

Commit fb3655d (use struct strbuf instead of static buffers -
2013-04-06) introduced a regression in the "section-from-path" handling
when the configured value is negative.  By changing the "rel" variable
so that it includes a trailing slash, counting slashes from the end of
the string no longer gives the same answer as it did before.

Fix this by ensuring that "rel" does not have a trailing slash.

Reported-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 16 Apr 2013 18:39:58 +0100
d483e8f5
t0001: ignore ".dirty" suffix on Git version

When testing modifications in Git that affect CGit, it is annoying to
have t0001 failing simply because the Git version has a ".dirty" suffix
when the version of Git there does indeed match that specified in the
CGit makefile.  Stop this by stripping the ".dirty" suffix from the
GIT_VERSION variable.

Note that this brings the "Git version" behaviour in line with the
"submodule version" case which does not check if the working tree in
git/ is modified.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 14 Apr 2013 19:15:43 +0100
31f56fc1
tests: set TEST_OUTPUT_DIRECTORY to the CGit test directory

By default, Git's test suite puts the trash directories and test-results
directory into its own directory, not that containing the tests being
run.  This is less convenient for inspecting test failures, so set the
output directory to CGit's tests/ directory instead.

Note that there is currently a bug in Git whereby it will create the
trash directories in our tests/ directory regardless of the value of
TEST_OUTPUT_DIRECTORY, and then fail to remove them once the tests are
done.  This change does currently affect the location of the
test-results/ directory though.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 14 Apr 2013 17:59:30 +0100
64f30688
t0109: test more URLs

In order to ensure that we don't access $HOME at some point after
initial startup when rendering a specific view, run the strace test on a
range of different pages.

This ensures that we don't end up reading a configuration later for some
specific view.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 14 Apr 2013 17:07:41 +0100
a8d613ef
cgitrc.5.txt: Specify when scan-path must be defined before.

Several options must be specified prior to scan-path. This is consistant
source of user confusion. Document these facts.

Suggested-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 10 Apr 2013 14:42:49 +0200
8c4c2c46
ui-snapshot.c: Prepend "V" when guessing ref names

In cgit_print_snapshot_links() we strip leading "v" and "V", while we
currently only prepend a lower case "v" when parsing a snapshot file
name. This results in broken snapshot links for tags that start with an
upper case "V". Avoid this by prepending a "V" as a fallback.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 10 Apr 2013 13:04:03 +0200
81bf4d32
t0107: Skip ZIP tests if unzip(1) isn't available

Note that we cannot use skip_all here since some tests have already been
executed when ZIP tests are reached. Use test prerequisites to skip
everything using unzip(1) if the binary is not available instead.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 09 Apr 2013 20:02:33 +0200
016364d4
tests/: Do not use `sed -i`

"-i" isn't part of the POSIX standard and doesn't work on several
platforms such as OpenBSD. Use a temporary file instead.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 09 Apr 2013 20:02:32 +0200
389cc173
Add branch-sort and repo.branch-sort options.

When set to "name", branches are sorted by name, which is the current
default. When set to "age", branches are sorted by the age of the
repository.

This feature was requested by Konstantin Ryabitsev for use on
kernel.org.

Proposed-by: Konstantin Ryabitsev <mricon@kernel.org>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 08 Apr 2013 16:57:12 +0200
880223dc
t0109: chain operations with &&

Without '&&' between operations, we will not detect if strace or cgit
exit with an error status, which would cause a false positive test
status in this case.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 10 Apr 2013 13:11:57 +0100
8d8e84e7
cgit.c: Do not restore unset environment variables

getenv() returns a NULL pointer if the specified variable name cannot be
found in the environment. However, some setenv() implementations crash
if a NULL pointer is passed as second argument. Only restore variables
that are not NULL.

See commit d96d2c98ebc4c2d3765f5b35c4142e0e828a421b for a related patch.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 10 Apr 2013 12:30:52 +0200
410da3ac
t0107: Use `tar -z` for gzip'ed archives

Some tar(1) versions do not support auto detection of the compression
type. Explicitly specify "-z" to decompress a ".tar.gz" archive.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 09 Apr 2013 00:13:52 +0200
dd1f0e5f
tests: Make sure that git does not access $HOME

With the latest changes to prevent git from accessing configuration
files that it should not, it's important to be sure that we won't
have further breakage in the future.

Use strace to implement a test to make sure cgit does not access()
anything built from $HOME.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 08 Apr 2013 22:18:21 +0200
9844c607
tests/.gitignore: update for using Git's test infrastructure

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 08 Apr 2013 20:12:34 +0100
c95cc5ec
tests: use Git's test framework

This allows tests to run in parallel as well as letting us use "prove"
or another TAP harness to run the tests.

Git's test framework requires Git to be fully built before letting any
tests run, so add a new target to the top-level Makefile which builds
all of Git instead of just libgit.a and make the "test" target depend on
that.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 01 Apr 2013 15:09:05 +0100
8a92df03
Do not load user or system gitconfig and gitattributes

While doing any kind of git loading, unset HOME variables and set
NOSYSTEM variables so that cgit does not load any settings that a user
may have set for his own /usr/bin/git usage.

This fixes a fatal error introduced with git 1.8, whereupon git would
fatally exit when failing to access particular files.

The result of this is that only repo-local configuration files are
accessed:

zx2c4@thinkpad ~/Projects/cgit $ HOME=/root QUERY_STRING="url=foo/log"
CGIT_CONFIG=tests/trash/cgitrc strace -e access ./cgit >/dev/null
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
access("repos/foo/.git/objects", X_OK) = 0
access("repos/foo/.git/refs", X_OK) = 0
access("repos/foo/.git/config", R_OK) = 0
access("repos/foo/.git/config", R_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
+++ exited with 0 +++

Reported-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Mon, 08 Apr 2013 21:12:19 +0200
fb3655df
use struct strbuf instead of static buffers

Use "struct strbuf" from Git to remove the limit on file path length.

Notes on scan-tree:
This is slightly involved since I decided to pass the strbuf into
add_repo() and modify if whenever a new file name is required, which
should avoid any extra allocations within that function.  The pattern
there is to append the filename, use it and then reset the buffer to its
original length (retaining a trailing '/').

Notes on ui-snapshot:
Since write_archive modifies the argv array passed to it we
copy the argv_array values into a new array of char* and then free the
original argv_array structure and the new array without worrying about
what the values now look like.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 06 Apr 2013 10:28:57 +0100
42d5476f
Remove redundant calls to fmt("%s", ...)

After this change there is one remaining call 'fmt("%s", delim)' in
ui-shared.c but is needed as delim is stack allocated and so cannot be
returned from the function.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 06 Apr 2013 10:49:22 +0100
ed5bd30e
Convert cgit_print_error to a variadic function

This removes many uses of "fmt" which uses a fixed size static pool of
fixed size buffers.  Instead of relying on these, we now pass around
argument lists for as long as possible before using a strbuf to render
content of an arbitrary size.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 06 Apr 2013 11:23:52 +0100
d2e20e38
shared.c: add strbuf_ensure_end

This is a small helper so that we can easily ensure that a strbuf ends
with the specified character.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Apr 2013 14:03:47 +0100
fd00d2f9
html.c: add various strbuf and varadic helpers

This adds the fmtalloc helper, html_txtf, html_vtxtf, and html_attrf.

These takes a printf style format string like htmlf but escapes the
resulting string.  The html_vtxtf variant takes a va_list whereas
html_txtf is variadic.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Apr 2013 14:40:50 +0100
57d09bf4
Mark char* fields in struct cgit_page as const

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Apr 2013 12:46:45 +0100
b1f17f16
Fix out-of-bounds memory accesses with virtual_root=""

The CGit configuration variable virtual_root is normalized so that it
does not have a trailing '/' character, but it is allowed to be empty
(the empty string and NULL have different meanings here) and there is
code that is insufficiently cautious when checking if it ends in a '/':

	if (virtual_root[strlen(virtual_root) - 1] != '/')

Clearly this check is redundant, but rather than simply removing it we
get a slight efficiency improvement by switching the normalization so
that the virtual_root variable always ends in '/'.  Do this with a new
"ensure_end" helper.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 01 Apr 2013 19:03:34 +0100
4b4a62d5
ui-refs.c: Refactor print_tag()

The code snippets for OBJ_TAG and other object types are almost
equivalent. Merge them and use a couple of inline if conditions to
select proper fields.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sat, 06 Apr 2013 23:39:08 +0200
caca860b
ui-refs.c: Remove global header variable

print_tag_header() is only called from cgit_print_tags() -- the
conditional invocation in print_tag() is never executed since
print_tag() is only called by cgit_print_tags() which already executes
print_tag_header() before (resulting in the global variable being always
set in when the condition is evaluated).

Remove the global variable and the conditional invocation.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sat, 06 Apr 2013 23:39:07 +0200
3edfd83d
html.c: Replace strdup() with xstrdup()

Use the xstrdup() wrapper which already bails out if strdup() returns a
NULL pointer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sat, 06 Apr 2013 13:30:54 +0200
8f208794
Always #include corresponding .h in .c files

While doing this, remove declarations from header files where the
corresponding definition is declared "static" in order to avoid build
errors.

Also re-order existing headers in ui-*.c so that the file-specific
header always comes immediately after "cgit.h", helping with future
consistency.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 06 Apr 2013 11:37:59 +0100
a5e4ad2d
cgit.mk: fix dependency handling

Git calculates the dependency files to be included using a simply
expanded Makefile variable, so it does not include the CGit objects that
are added after that Makefile has been processed.

We therefore need to include the dependency files ourselves in order to
get the dependency calculations right.  Do this.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Thu, 04 Apr 2013 18:32:24 +0100
cfb77e97
Makefile: re-include cgit.conf in cgit.mk

This avoids needed to export every variable that might be used in
cgit.mk from the top-level Makefile.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 01 Apr 2013 14:14:12 +0100
a92678b5
Do not unnecessarily strdup() environment variables

This reverts the memory duplication introduced in commit 60a2627, while
keeping everything else that has been cleaned up. The environment
variables are never modified, so we do not need to call xstrdupn() here.

Also, remove xstrdupn() which is no longer needed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 01 Apr 2013 17:11:15 +0200
3a843243
Maŕk cgit_environment members const

These reflect the values of environment variables and should never be
changed. Add another xstrdup() when we assign environment variables to
strings that are potentially non-constant.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 01 Apr 2013 17:11:14 +0200
996f86e6
Return const char * in cgit_{httpscheme, hosturl, rooturl}()

The return values of these functions are essentially constant and should
never be modified.

Note that this will introduce a compiler warning when we try to free the
return value of any of these functions. However, given that all of these
currently return statically allocated strings in some cases, they need
to be refactored before this can be done anyway.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 01 Apr 2013 17:11:13 +0200
849ecd96
Update git to v1.8.2.1

This requires a small change to how we handle notes, but otherwise just
works.

Note that we can't use anything from v1.8.0 until v1.8.2.1 because some
of the symbols that we need for graph drawing were made private in
v1.8.0 and this was not reverted until v1.8.2.1.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 08 Apr 2013 09:00:22 +0100
1c32e008
ui-blob: don't segfault when no path is given

It it possible to inspect blobs by specifying only the SHA-1, and CGit
provides links to do so, for example if a tag points directly at a blob.
In this case the path_items structure is never used, but creating it
still causes strlen to be run on a null pointer.  Fix this.

This error was introduced by commit c1633c6 (Update git to v1.7.6.5 -
2013-03-02).

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sun, 07 Apr 2013 15:06:23 +0100
b60e6bff
Convert pager navigation into a unordered list

It is common practice and semantically appropriate to use unordered
lists for long navigation lists.

This also fixes the layout of very long pager navigations in
Webkit-based browsers.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Thu, 07 Mar 2013 08:56:22 +0100
121089ce
Makefile: remove CGIT-CFLAGS files in clean stage
Jason A. Donenfeld Jason@zx2c4.com
Wed, 20 Mar 2013 21:14:22 +0100
977a3ad7
ui-summary.c: Move urls variable into print_urls()

There's no need for this variable to be global. Printing the header in
print_urls() instead of print_url() allows for moving this variable into
print_urls() without having to pass any status to print_url().

Note that this only works as long as we don't call print_urls() more
than once.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 05 Mar 2013 16:48:27 +0100
ef8a97d9
Fix colspan values

This fixes a couple of minor oversights in previous commits and adjusts
all cells using colspan to use the correct width.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Tue, 05 Mar 2013 15:42:14 +0100
6d7e3596
html: check return value of write

This squelches a gcc warning. It's also correct that we check to see if
there are any partial or failed writes. For now, we just print a warning
to stderr. In the future, perhaps it will prove wise to exit(1) on
partial writes.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 20 Mar 2013 20:44:20 +0100
40e1d9b6
ui-shared: squelch compiler warning.

Since tail is initialized to 0, we will never get a warning on the last
if statement, but recent gcc complains anyway. So, we initialize len as
well. Future gcc versions should be able to optimize this out anyway.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 20 Mar 2013 20:43:13 +0100
7669f7f7
cgit.mk: Use SHELL_PATH_SQ to run gen-version.sh

On some platforms (notably Solaris) /bin/sh doesn't support enough of
POSIX for gen-version.sh to run.  Git's Makefile provides SHELL_PATH_SQ
to address this issue so we just have to use it.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 06 Mar 2013 21:22:09 +0000
d6768a67
cgit.mk: don't rebuild everything if CGIT_VERSION changes

If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example
because you have committed your changes) causes all of the CGit objects
to be rebuilt.  Avoid this by using EXTRA_CPPFLAGS to add the version
for only those files that are affected and make them depend on VERSION.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 06 Mar 2013 21:22:08 +0000
1a6feaf5
ui-patch: use cgit_version not CGIT_VERSION

We already have a global cgit_version which is set from the #define'd
CGIT_VERSION in cgit.c.  Change ui-patch.c to use this so that we only
need to rebuild cgit.o when the version changes.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 06 Mar 2013 21:22:07 +0000
5f323c1f
Makefile: re-use Git's Makefile where possible

Git does quite a lot of platform-specific detection in its Makefile,
which can result in it defining preprocessor variables that are used in
its header files.  If CGit does not define the same variables it can
result in different sizes of some structures in different places in the
same application.

For example, on Solaris Git uses it's "compat" regex library which has a
different sized regex_t structure than that available in the platform
regex.h.  This has a knock-on effect on the size of "struct rev_info"
and leads to hard to diagnose runtime issues.

In order to avoid all of this, introduce a "cgit.mk" file that includes
Git's Makefile and make all of the existing logic apply to CGit's
objects as well.  This is slightly complicated because Git's Makefile
must run in Git's directory, so all references to CGit files need to be
prefixed with "../".

In addition, OBJECTS is a simply expanded variable in Git's Makefile so
we cannot just add our objects to it.  Instead we must copy the two
applicable rules into "cgit.mk".  This has the advantage that we can
split CGit-specific CFLAGS from Git's CFLAGS and hence avoid rebuilding
all of Git whenever a CGit-specific value changes.

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: Jamie Couture <jamie.couture@gmail.com>
John Keeping john@keeping.me.uk
Wed, 06 Mar 2013 21:22:06 +0000
e1e0e038
tests: check that Git version are in sync

This ensures that the Git version pointed at by the submodule is the
same as the one that will be fetched using "make get-git".

Suggested-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Tue, 19 Mar 2013 20:00:29 +0000
0255821e
Merge branch 'wip'
Jason A. Donenfeld Jason@zx2c4.com
Wed, 20 Mar 2013 20:21:25 +0100
6d8a789d
ui-shared: fix return type of cgit_self_link

cgit_self_link() is a void function but implements each case it handles
by doing "return <another_void_function>" which is not valid C; section
6.8.6.4 of C11 says:

	A return statement with an expression shall not appear in a
	function whose return type is void.

Fix this by removing the return keywords and converting the final code
block into an "else".

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 06 Mar 2013 20:51:54 +0000
d5a43b42
t0107-snapshot: add tests for ZIP archives

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 04 Mar 2013 21:58:51 +0000
f9b801a1
tests: make whitespace consistent

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 04 Mar 2013 21:58:50 +0000
392e07d2
tests: "grep -e" is not portable to all platforms

The "-e" option to grep is not needed unless specifying more than one
pattern, which we don't do.  Remove it to avoid restricting the tests on
platforms that do not have a grep that recognises "-e".

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Mon, 04 Mar 2013 21:58:49 +0000
78a24e5c
Makefile: Disable gettext in the Git submodule

Newer libgit versions depend on the libintl library. However, we
currently do not link against libintl which breaks compilation under
OpenBSD:

    git/libgit.a(commit.o)(.text+0x1d1b): In function `lookup_commit_or_die':
    git/gettext.h:47: undefined reference to `libintl_gettext'
    [...]

Since we do not support i18n in cgit, just disable gettext in the Git
submodule to fix this.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 09:18:38 +0100
ca59b26d
Makefile: improve dependency generation

Makefile target generation would always be included for any makefile
target that was not clean.  Only care to include the '.deps' directory
when building cgit, rather than generating and including dependencies
when calling other makefile targets.

Heavily borrowed from git's Makefile, but without definitions to test
for the compiler's header dependency feature.  Previous Makefile
implementation never checked for this compiler feature anyway.

  - Removed makecmdgoal 'clean' check
  - Grouped like .PHONY target definitions
  - Place build dependency targets under .SUFFIXES
  - Re-arranged location of library inclusion definitions
  - Use google code mirror instead of github

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jamie Couture jamie.couture@gmail.com
Sat, 17 Nov 2012 13:02:17 -0500
fac4da38
cgit.c: Remove parameter from guess_defbranch()

We use resolve_ref() since commit 8d7c2ec2, so this is no longer needed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 22:42:35 +0100
210a5711
ui-tree.c: Use a context structure in walk_tree()

Use the context pointer to pass context information instead of misusing
global variables, as we already did in "ui-blob.c" and in "ui-plain.c".

In addition to the fixes to walk_tree(), pass the same structure to
ls_tree() and ls_item() which is read_tree_recursive()-based as well.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 17:22:30 +0100
bfe57662
ui-tree.c: Drop the header variable

Instead, use the value of the state variable to determine whether the
footer needs to be drawn.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 16:55:21 +0100
c4b8db3f
ui-tree.c: Declare the state variable globally

This allows for removing the header variable in a following patch. We
can use the state variable to check whether the tail needs to be printed
instead.

Note that the state variable will be moved into a context structure
later.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 16:49:47 +0100
fb5a3731
ui-tree.c: Pass current revision to print_object()

No longer access the global curr_rev variable in print_object().

This will make it easier to squash the curr_rev variable into a context
structure without having to pass the context to the print_object()
function.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 16:45:14 +0100
b1db30cd
ui-plain.c: Use a context structure in walk_tree()

Do not misuse global variables to save the context. Instead, use the
context pointer which was designed to share information between a
read_tree_fn and the caller.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 17:27:54 +0100
a6317505
ui-plain.c: Do not access match variable in print_*()

Move all code setting the match variable to walk_tree().

This allows for easily moving this variable into a context structure
without having to pass the context to print_*().

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 17:10:19 +0100
41f9c4e2
ui-blob.c: Use a context structure in walk_tree()

Do not misuse global variables to save the context. Instead, use the
context pointer which was designed to share information between a
read_tree_fn and the caller.

This also prevents from potential misuse of the global pointers
match_path and matched_sha1 after the referenced values have been
overwritten on the stack.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 17:27:46 +0100
973deda0
ui-snapshot.c: Fill argv[0] with dummy.

parse_archive_args does not pass PARSE_OPT_KEEP_ARGV0 to parse_args,
which means the first argument will be discarded, as though it were a
function being called from the command-line. Thus, we fill argv[0] with
a dummy argument to prevent this from happening.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 03 Mar 2013 23:41:53 -0500
bdae1d8a
White space around control verbs.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Sun, 03 Mar 2013 23:21:33 -0500
53bc747d
Fix several whitespace errors

* Remove whitespace at the end of lines.
* Replace space indentation by tabs.
* Add whitespace before/after several operators ("+", "-", "*", ...)
* Add whitespace to assignments ("foo = bar;").
* Fix whitespace in parameter lists ("foobar(foo, bar, 42)").

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Sun, 03 Mar 2013 16:04:29 +0100
7f4e8c33
Update git to v1.7.12.4

No changes needed.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 02 Mar 2013 12:32:15 +0000
10628b0e
Update git to v1.7.9.7

resolve_ref() is renamed to resolve_ref_unsafe().  CGit's usage is safe.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 02 Mar 2013 12:32:14 +0000
87369611
Update git to v1.7.8.6

No changes required.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 02 Mar 2013 12:32:13 +0000
2ab1cd9f
Update git to v1.7.7.7

This release changes the archive interface so that we now need to pass
argv into write_archive().

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 02 Mar 2013 12:32:12 +0000
c1633c6b
Update git to v1.7.6.5

struct pathspec is now used in more places.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 02 Mar 2013 12:32:11 +0000
bfc14d06
Update git to v1.7.5.4

Some changes to diff options:

- no_merges has become the more general max_parents
- path restriction now uses struct pathspec

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Sat, 02 Mar 2013 12:32:10 +0000
c0a92e82
Print submodule revision next to submodule link
stfn stfnmd@gmail.com
Wed, 27 Feb 2013 19:47:17 +0100
05da4c28
Support unannotated tags in git-clone.

Matthew McClintock reported that older unannotated tags were not
correctly being cloned and did not appear in info/refs. Further
investigation revealed some dubious prefix comparison code for
determining whether or not to write refs in info/refs. After comparing
it with git's own http-backend.c, it appears upstream does not use this
prefix logic.

OTOH, I don't know what the reasoning was when the prefix logic was
introduced. It appears to me to just be buggy, though it's possible
there are other reasons, and we'll have to revisit this commit.

But for now, Works For Me.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Matthew McClintock <msm@freescale.com>
Reported-by: Matthew McClintock <msm@freescale.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 01 Feb 2013 21:08:51 +0100
225c8aba
ssdiff: correctly manage tab expansion

Previously, replace_tabs("foo\tbar") would become "        foobar".

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Julius Plenz plenz@cis.fu-berlin.de
Thu, 15 Nov 2012 17:35:06 +0100
b1e172ac
Make "owner" column on index page configurable

This is not really needed for personal sites where all repos belong to
the same person. Since it is pretty useful for shared sites however, it
should be configurable.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Florian Pritz bluewind@xinu.at
Fri, 01 Feb 2013 10:59:13 +0100
c6f5bc72
man: fix up default value duplication
Jason A. Donenfeld Jason@zx2c4.com
Thu, 15 Nov 2012 17:21:47 +0100
a6a932e1
CGIT-0.9.1

Enhancements:
- path-selected submodule links
- intelligent default branch guessing
- /etc/mime.types lookup
- gitweb.* and cgit.* git-config support
- case insensitive sorting and age sorting
- commit, repository, and section sorting
- bold currently viewed page in pagination
- support BSDs in makefile

Security:
- CVE-2012-4465: heap-buffer overflow in parsing.c
- CVE-2012-4548: syntax highlighting command injection

Bug Fixes:
- transition maintainer to Jason Donenfeld (zx2c4)
- download git snapshot from github instead of Lars' old server
- css fixes
- stablization of tests
- more compatible default highlight script
- suppress gzip timestamp so that tarballs only use tar timestamps
- treat ctags as target in makefile
- do not let global variables override certain local repo settings
- print ampersand as proper html entity
- use placeholder for empty commit subject
- format diff view for addition and removal of files
- point links at correct blob from ssdiff

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 15 Nov 2012 01:28:59 +0100
ab9805aa
man: show mime type default value
Jason A. Donenfeld Jason@zx2c4.com
Thu, 15 Nov 2012 01:26:06 +0100
c6fe94e0
ssdiff: point line links at exact blob by prepending "id="

Previously, the id_str (i.e. the current or diffed-against commit's
SHA1 ID) was simply concatenated to the URL. Now, prepend an "id="
string so that the links actually point to the right blobs and thus
the exact lines.

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Julius Plenz plenz@cis.fu-berlin.de
Tue, 30 Oct 2012 13:56:01 +0100
62a40c78
Format git diff headers correctly when adding or removing files.

Copying the output of cgit and using it in patches now works when adding
files to or removing files from the repository. This is helpful for people
who use cgit in their patch workflow.
Michael Halstead michael@yoctoproject.org
Wed, 14 Nov 2012 12:41:01 -0800
633a66c8
Makefile: get snapshots from github

Github will have more bandwidth than Lars' server.
Ferry Huberts ferry.huberts@pelagic.nl
Sat, 03 Nov 2012 17:49:45 -0600
2b675d20
Makefile: remove tags file

Remove tags file from working directory.

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Jamie Couture jamie.couture@gmail.com
Wed, 31 Oct 2012 19:43:12 -0400
fe1bb0e7
ui-shared: use placeholder for empty commit subject

Display a placeholder when creating links to commits with empty subjects.
This avoids the creation of links of the form <a></a>.
Christian Franke nobody@nowhere.ws
Sun, 28 Oct 2012 18:36:08 +0100
7ea35f9f
syntax-highlighting.sh: Fix command injection.

By not quoting the argument, an attacker with the ability to add files
to the repository could pass arbitrary arguments to the highlight
command, in particular, the --plug-in argument which can lead to
arbitrary command execution.

This patch adds simple argument quoting.
Jason A. Donenfeld Jason@zx2c4.com
Sat, 27 Oct 2012 20:03:41 -0600
37141051
Fix man page typo.
Jason A. Donenfeld Jason@zx2c4.com
Thu, 18 Oct 2012 23:36:44 +0200
a58d8a16
Makefile: Support OpenBSD just like FreeBSD
Jason A. Donenfeld Jason@zx2c4.com
Wed, 17 Oct 2012 21:55:48 +0200
2853692a
Makefile: support FreeBSD libiconv paths

According to Dan Rue <drue@therub.org>, FreeBSD requires the lib paths
to get libiconv from /usr/local.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 17 Oct 2012 18:30:08 +0200
1cb8b494
tests: check for proper html entity

Since we're now properly writing ampersand literals as &amp; instead of
as a plain &, we need to update the test accordingly.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 17 Oct 2012 17:17:48 +0200
792f813d
ui-log: Add "commit-sort" option for controlling commit ordering

This makes it possible to use strict commit date ordering or strict
topological ordering by passing the corresponding flags to "git log".

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tobias Bieniek Tobias.Bieniek@gmx.de
Sat, 13 Oct 2012 16:10:30 +0200
7a4e7c8f
ui-repolist: Add "section-sort" flag to control section sorting.

Flag which, when set to "1", will sort the sections on the repository
listing by name. Set this flag to "0" if the order in the cgitrc file
should be preserved. Default value: "1".

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tobias Bieniek Tobias.Bieniek@gmx.de
Tue, 09 Oct 2012 20:53:29 +0200
521e10c8
scan-tree: Unify gitweb.* and cgit.* settings into one config option.

After some back and forth with Jamie and René, it looks like the git
config semantics are going to be like this:

- gitweb.category maps to the cgit repo config key "section"
- gitweb.description maps to the cgit repo config key "desc"
- gitweb.owner maps to the cgit repo config key "owner"
- cgit.* maps to all cgit repo config keys

This option can be enabled with "enable-git-config=1", and replaces
all previous "enable-gitweb-*" config keys.

The order of operations is as follows:

- git config settings are applied in the order that they exist in
  the git config file
- if the owner is not set from git config, get the owner using the
  usual getpwuid call
- if the description is not set from git config, look inside the
  static $path/description file
- if section-from-path=1, override whatever previous settings were
  inside of git config using the section-from-path logic
- parse $path/cgitrc for local repo.* settings, that override all
  previous settings
Jason A. Donenfeld Jason@zx2c4.com
Tue, 09 Oct 2012 06:56:14 -0400
c366bd6f
ui: Remember to print ampersand as proper html entities.
William Bell william.bell@frog.za.net
Tue, 09 Oct 2012 20:45:58 +0200
fdfb6a6d
ui-repolist: Rename section-sort to repository-sort.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Tue, 16 Oct 2012 23:32:40 +0200
8f40be22
repo_config: do not let globals override repo settings

This makes it possible to activate the enable_commit_graph,
enable_log_filecount, and enable_log_linecount for individual
repositories, even if the global setting is "0" (default).

The commit that introduced the broken behavior was e189344, and the
commit message of that makes it clear that this wasn't the intended
behavior.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tobias Bieniek Tobias.Bieniek@gmx.de
Wed, 18 Apr 2012 12:32:13 +0200
a9a6a205
README: times, they are a-changin
Jason A. Donenfeld Jason@zx2c4.com
Tue, 09 Oct 2012 13:21:30 +0200
d14faf44
syntax-highlight: when the file has no extension, assume text

There are 2 situations:
1- empty extension: assuming text is better than highlight
   producing no output because of a missing argument.
2- no extension at all: assuming text is better than setting
   the extension to the filename, which is what now happens.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Tue, 09 Oct 2012 13:10:48 +0200
e52a5226
ui-repolist: do not use agefile if it's date could not be parsed

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Tue, 09 Oct 2012 13:09:58 +0200
2ad9063c
Revert "filters/syntax-highlighting.sh: work around highlight --force bug"

This reverts commit f50be7fda0a7ab57009169dd5905fcbab8eb5166.

An update with the latest highlight landed in EPEL. This new version
doesn't have the --force bug, so the workaround can now be removed.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Tue, 09 Oct 2012 13:08:30 +0200
6419c9b5
Makefile: add tag target to generate ctags

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Jamie Couture jamie.couture@gmail.com
Mon, 08 Oct 2012 13:12:17 -0400
4675b912
ui-repolist: Bold the currently viewed page.

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Jamie Couture jamie.couture@gmail.com
Mon, 08 Oct 2012 12:49:34 -0400
61d4147e
do not write outside heap buffer

* parsing.c (substr): Handle tail < head.

This started when I noticed some cgit segfaults on savannah.gnu.org.
Finding the offending URL/commit and then constructing a stand-alone
reproducer were far more time-consuming than writing the actual patch.

The problem arises with a commit like this, in which the user name
part of the "Author" field is empty:

    $ git log -1
    commit 6f3f41d73393278f3ede68a2cb1e7a2a23fa3421
    Author: <T at h.or>
    Date:   Mon Apr 23 22:29:16 2012 +0200

Here's what happens:

(this is due to buf=malloc(0); strncpy (buf, head, -1);
 where "head" may point to plenty of attacker-specified non-NUL bytes,
 so we can overwrite a zero-length heap buffer with arbitrary data)

 Invalid write of size 1
    at 0x4A09361: strncpy (mc_replace_strmem.c:463)
    by 0x408977: substr (parsing.c:61)
    by 0x4089EF: parse_user (parsing.c:73)
    by 0x408D10: cgit_parse_commit (parsing.c:153)
    by 0x40A540: cgit_mk_refinfo (shared.c:171)
    by 0x40A581: cgit_refs_cb (shared.c:181)
    by 0x43DEB3: do_for_each_ref (refs.c:690)
    by 0x41075E: cgit_print_branches (ui-refs.c:191)
    by 0x416EF2: cgit_print_summary (ui-summary.c:56)
    by 0x40780A: summary_fn (cmd.c:120)
    by 0x40667A: process_request (cgit.c:544)
    by 0x404078: cache_process (cache.c:322)
  Address 0x4c718d0 is 0 bytes after a block of size 0 alloc'd
    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
    by 0x455C85: xmalloc (wrapper.c:35)
    by 0x40894C: substr (parsing.c:60)
    by 0x4089EF: parse_user (parsing.c:73)
    by 0x408D10: cgit_parse_commit (parsing.c:153)
    by 0x40A540: cgit_mk_refinfo (shared.c:171)
    by 0x40A581: cgit_refs_cb (shared.c:181)
    by 0x43DEB3: do_for_each_ref (refs.c:690)
    by 0x41075E: cgit_print_branches (ui-refs.c:191)
    by 0x416EF2: cgit_print_summary (ui-summary.c:56)
    by 0x40780A: summary_fn (cmd.c:120)
    by 0x40667A: process_request (cgit.c:544)

 Invalid write of size 1
    at 0x4A09400: strncpy (mc_replace_strmem.c:463)
    by 0x408977: substr (parsing.c:61)
    by 0x4089EF: parse_user (parsing.c:73)
    by 0x408D10: cgit_parse_commit (parsing.c:153)
    by 0x40A540: cgit_mk_refinfo (shared.c:171)
    by 0x40A581: cgit_refs_cb (shared.c:181)
    by 0x43DEB3: do_for_each_ref (refs.c:690)
    by 0x41075E: cgit_print_branches (ui-refs.c:191)
    by 0x416EF2: cgit_print_summary (ui-summary.c:56)
    by 0x40780A: summary_fn (cmd.c:120)
    by 0x40667A: process_request (cgit.c:544)
    by 0x404078: cache_process (cache.c:322)
  Address 0x4c7192b is not stack'd, malloc'd or (recently) free'd

 Invalid write of size 1
    at 0x4A0940E: strncpy (mc_replace_strmem.c:463)
    by 0x408977: substr (parsing.c:61)
    by 0x4089EF: parse_user (parsing.c:73)
    by 0x408D10: cgit_parse_commit (parsing.c:153)
    by 0x40A540: cgit_mk_refinfo (shared.c:171)
    by 0x40A581: cgit_refs_cb (shared.c:181)
    by 0x43DEB3: do_for_each_ref (refs.c:690)
    by 0x41075E: cgit_print_branches (ui-refs.c:191)
    by 0x416EF2: cgit_print_summary (ui-summary.c:56)
    by 0x40780A: summary_fn (cmd.c:120)
    by 0x40667A: process_request (cgit.c:544)
    by 0x404078: cache_process (cache.c:322)
  Address 0x4c7192d is not stack'd, malloc'd or (recently) free'd

 Process terminating with default action of signal 11 (SIGSEGV)
  Access not within mapped region at address 0x502F000
    at 0x4A09400: strncpy (mc_replace_strmem.c:463)
    by 0x408977: substr (parsing.c:61)
    by 0x4089EF: parse_user (parsing.c:73)
    by 0x408D10: cgit_parse_commit (parsing.c:153)
    by 0x40A540: cgit_mk_refinfo (shared.c:171)
    by 0x40A581: cgit_refs_cb (shared.c:181)
    by 0x43DEB3: do_for_each_ref (refs.c:690)
    by 0x41075E: cgit_print_branches (ui-refs.c:191)
    by 0x416EF2: cgit_print_summary (ui-summary.c:56)
    by 0x40780A: summary_fn (cmd.c:120)
    by 0x40667A: process_request (cgit.c:544)
    by 0x404078: cache_process (cache.c:322)

This happens when tail - head == -1 here:
(parsing.c)

  char *substr(const char *head, const char *tail)
  {
          char *buf;

          buf = xmalloc(tail - head + 1);
          strncpy(buf, head, tail - head);
          buf[tail - head] = '\0';
          return buf;
  }

  char *parse_user(char *t, char **name, char **email, unsigned long *date)
  {
          char *p = t;
          int mode = 1;

          while (p && *p) {
                  if (mode == 1 && *p == '<') {
                          *name = substr(t, p - 1);
                          t = p;
                          mode++;
                  } else if (mode == 1 && *p == '\n') {

The fix is to handle the case of (tail < head) before calling xmalloc,
thus avoiding passing an invalid value to xmalloc.

And here's the reproducer:
It was tricky to reproduce, because git prohibits use of an empty "name"
in a commit ID.  To construct the offending commit, I had to resort to
using "git hash-object".

git init -q foo &&
( cd foo &&
  echo a > j && git add . && git ci -q --author='au <T at h.or>' -m. . &&
  h=$(git cat-file commit HEAD|sed 's/au //' \
    |git hash-object -t commit -w --stdin) &&
  git co -q -b test $h &&
  git br -q -D master &&
  git br -q -m test master)
git clone -q --bare foo foo.git

cat <<EOF > in
repo.url=foo.git
repo.path=foo.git
EOF
CGIT_CONFIG=in QUERY_STRING=url=foo.git valgrind ./cgit

The valgrind output is what you see above.

AFAICS, this is not exploitable thanks (ironically) to the use of strncpy.
Since that -1 translates to SIZE_MAX and this is strncpy, not only does it
copy whatever is in "head" (up to first NUL), but it also writes
SIZE_MAX - strlen(head) NUL bytes into the destination buffer, and that
latter is guaranteed to evoke a segfault.  Since cgit is single-threaded,
AFAICS, there is no way that the buffer clobbering can be turned into
an exploit.
Jim Meyering meyering@redhat.com
Mon, 23 Apr 2012 22:06:35 +0200
055e092a
ui-snapshot: pass -n to gzip, to suppress timestamp

Since cgit snapshots of tags are often used for releases, we don't
want the rarely used feature of the gzip compressor that includes
an embedded timestamp into the archive, since this makes each tarball
of the same (potentially signed) tag different.

This commit refactors the archive handling code a bit so that each
different format is able to run with an arbitrary argv for the filter.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 26 Sep 2012 02:56:38 +0200
7f08e039
Update copyright headers to have latest dates.
Jason A. Donenfeld Jason@zx2c4.com
Thu, 12 Jul 2012 20:00:40 +0200
184c5655
ui-repolist: Case insensitive sorting and age sort

Add two options, one for doing the ordinary name sorts in a
case-insensitive manner, and another for choosing to sort repos in each
section by age instead of by name.
Jason A. Donenfeld Jason@zx2c4.com
Thu, 12 Jul 2012 19:13:39 +0200
fc9181ff
scan-tree: Support gitweb.category.

Use gitweb.category from git config to determine repo's section, if
option is enabled.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 11 Jul 2012 05:32:45 +0200
b56be4ba
scan-tree: Support gitweb.description.

Use gitweb.description instead of description file to determine
description, if option is enabled.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 11 Jul 2012 04:24:01 +0200
45555512
css: only use div#cgit

Don't bother with 'body' and 'div#cgit form', since
everything is wrapped in 'div#cgit' already.
Removing these two types makes embedding even easier.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Mon, 19 Mar 2012 23:09:25 +0100
ae90a0b2
Merge branch 'fh/mimetypes'
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 21:01:28 +0000
181b6e78
Merge branch 'jp/defbranch'
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 21:00:18 +0000
2b9fab8d
Merge branch 'lh/module-links'
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 20:59:36 +0000
08352c7a
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 20:23:30 +0000
6e63ebfe
css: force text color to black on decorations

improves readability when embedding into a page that
has the text color set to a different color

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:44:05 +0100
fac65a7e
css: vertically align the cgit logo image

When embedding cgit in other pages, the logo alignment needs to be
specified to avoid any css rules from the embedding page to make the
page look bad.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:44:04 +0100
add1ccb1
css: prefix all styles with div#cgit

to facilitate easier embedding

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:44:03 +0100
7996157f
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 10:19:59 +0000
961893b5
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 10:10:10 +0000
1de3048d
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 03 Jan 2012 21:19:29 +0000
aa25ff3c
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 03 Jan 2012 16:48:22 +0000
19574257
ui-ssdiff.c: set correct diffmode in "control panel"

When side-by-side-diffs=1 was set in cgitrc, specifying 'ss=0' in the
querystring would not set the 'unified' option as active in the dropdown
box used to select diffmode.
Tim Chen timchen1@gmail.com
Tue, 03 Jan 2012 16:09:59 +0000
04254fa9
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 03 Jan 2012 16:06:58 +0000
d96d2c98
shared.c: Only setenv() if value is non-null

Some setenv() implementations (e.g. the one in OpenBSD's stdlib)
segfault if we pass a NULL value. Only set environment variables if the
corresponding settings are defined to avoid this.

Note that this is a minor behaviour change as environment variables were
supposed to be set to an empty string if a setting was undefined. Given
that this feature isn't part of any official release yet, there's no
need to worry about backwards compatibility, really. Change the
documentation accordingly.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Wed, 14 Sep 2011 11:52:43 +0200
8185169e
shared.c: Remove unused "linux/limits.h" include

This isn't used anywhere and prevents the code from being compiled on
other platforms, such as *BSD.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Fri, 22 Jul 2011 17:15:49 +0200
756e3ea6
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Fri, 22 Jul 2011 12:22:17 +0000
bf8c7a4c
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 21 Jul 2011 14:27:03 +0000
73e13e2b
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 21 Jul 2011 12:50:07 +0000
96f05018
Makefile: fix oversight of not using $(DESTDIR) in uninstall

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Mon, 18 Jul 2011 12:45:56 +0200
afdff8dc
commit-links.sh: improve regular expressions

The default length for sha1 abbreviations in git is 7.

A '#num' at the beginning of the commit message is now
recognised, a ':#num' as well, etc.: a '#num' anywhere
is now converted to a link.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Mon, 18 Jul 2011 12:45:20 +0200
b0d72da0
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 18 Jun 2011 14:59:51 +0200
8729d251
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Wed, 15 Jun 2011 10:40:00 +0200
1b1bf635
Merge branch 'lh/clone-url'
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 23:05:10 +0000
b88cda6e
cgitrc.5.txt: reformat the "FILTER API" section

This patch makes the generated man-page for the filer api section more
similar to the other sections. Also, the bulleted list of environment
variables wasn't rendered correctly (with asciidoc 8.5.2), without an
empty line before the first item.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 22:34:13 +0000
859d106d
Merge branch 'stable'

Conflicts:
	cgitrc.5.txt
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 22:02:02 +0000
be6991c1
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 13:28:18 +0000
19e371c5
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 12:41:01 +0000
fb3b9471
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 12 Jun 2011 21:23:14 +0000
f8f6e1fe
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 06 Jun 2011 19:12:21 +0000
7eb9f9e9
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 02 Jun 2011 10:33:23 +0000
9acd1cf1
ui-stats.c: fix invalid html

Found by http://validator.w3.org.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 30 May 2011 22:21:22 +0000
52fbcf2f
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 30 May 2011 23:57:25 +0200
21e0e0bf
ui_repolist: get modtime from packed-refs as fallback

When no modtime could be determined then as a final
fallback try to get it from the packed-refs.

This will show an idle time when a repository has been packed
with all refs in the packed-refs.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Fri, 13 May 2011 23:09:34 +0200
2ffeecb7
Merge branch 'lh/panel'
Lars Hjemli hjemli@gmail.com
Mon, 23 May 2011 23:29:24 +0200
ab350a77
Merge branch 'fh/filter-api'

Conflicts:
	cgit.c
Lars Hjemli hjemli@gmail.com
Mon, 23 May 2011 23:28:38 +0200
652a5a18
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 23 May 2011 23:26:10 +0200
4837fddc
Merge branch 'dm/disable-clone'
Lars Hjemli hjemli@gmail.com
Sat, 14 May 2011 20:00:33 +0200
568d8d3f
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 26 Mar 2011 15:22:35 +0100
2e6721ed
make enable-log-linecount independent of -filecount

You should be able to independently switch file and line count on and
off. This patch makes the code work like the documentation suggests: no
dependency for line counts to be displayed only when file counts are.

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Julius Plenz plenz@cis.fu-berlin.de
Thu, 10 Mar 2011 17:03:22 +0100
5db02854
new_filter: correctly initialise all arguments for a new filter

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Wed, 09 Mar 2011 08:16:59 +0100
3f1ebd35
source_filter: fix a memory leak

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Wed, 09 Mar 2011 08:16:58 +0100
4d2a303c
cgitrc.5: tar.xz is a supported snapshot format

When tar.xz support was added in 0642435fed (2009-12-08: Add
.tar.xz-snapshot support), cgitrc.5 was not updated to match. This
patch fixes the issue.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 26 Mar 2011 13:40:20 +0100
f15c5833
Fix crash when projectsfile cannot be opened

This patch makes cgit properly abort in case the projectsfile cannot
be opened. Without the added return cgit continues using the projects
pointer which is NULL and thus causes a segfault.
Stefan Gehn stefan@srcbox.net
Sat, 26 Mar 2011 09:51:39 +0100
cc59ee50
CGIT 0.9

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 05 Mar 2011 14:23:12 +0100
b9025b5c
Update README
Lars Hjemli hjemli@gmail.com
Sat, 05 Mar 2011 14:21:47 +0100
7f3c6e0c
ui-diff.c: avoid html injection

When path-filtering was used in commit-view, the path filter was
included without proper html escaping. This patch closes the hole.

Signed-off-by: Lukasz Janyst <ljanyst@cern.ch>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukasz Janyst ljanyst@cern.ch
Sat, 05 Mar 2011 14:10:55 +0100
1b09cbd3
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 05 Mar 2011 14:01:59 +0100
979c460e
Merge branch 'br/misc'

* br/misc:
  Use transparent background for the cgit logo
  ssdiff: anchors for ssdiff
  implement repo.logo and repo.logo-link
Lars Hjemli hjemli@gmail.com
Sat, 19 Feb 2011 14:51:00 +0100
fb9e6d15
Merge branch 'jh/scan-path'

* jh/scan-path:
  scan_path(): Do not recurse into hidden directories by default
  scan_path(): Improve handling of inaccessible directories
Lars Hjemli hjemli@gmail.com
Sat, 19 Feb 2011 14:25:55 +0100
31e1f9af
Merge branch 'jh/graph'

* jh/graph:
  ui-log: Move 'Age' column when commit graph is present
  ui-log: Line-wrap long commit subjects when showmsg is enabled
  ui-log: Colorize commit graph
  ui-log: Implement support for commit graphs
  ui-log: Change display of full commit messages (and notes)

Conflicts:
	cgit.css
Lars Hjemli hjemli@gmail.com
Sat, 19 Feb 2011 14:01:59 +0100
e66a16ce
Merge branch 'lh/improve-range-search'

* lh/improve-range-search:
  html.c: use '+' to escape spaces in urls
  ui-log.c: improve handling of range-search argument
  Add vector utility functions
Lars Hjemli hjemli@gmail.com
Sat, 19 Feb 2011 14:00:56 +0100
286c4c0a
Use GIT-1.7.4

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 19 Feb 2011 13:55:43 +0100
17596459
ui-stats: Remove unnecessary #include

<string-list.h> is already #included from cgit.h

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 18:39:48 +0100
7618cac1
Merge branch 'tz/make-improvements'
Lars Hjemli hjemli@gmail.com
Wed, 10 Nov 2010 00:28:56 +0100
52558a6d
ui-log: Prevent crash when given empty range search

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 28 Oct 2010 17:05:39 +0200
53f487dd
Makefile: avoid spurious rebuilds of git sources due to `sudo make`

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 09 Nov 2010 18:08:38 +0100
1415f3f3
ui-log: Fix filecount/linecount when path limit is in effect

When using ui-log with path limits, the listing of commits enables parent
rewriting in Git's internal log machinery. This did not work well together
with cgit_diff_commit() which is used to generate the filecount and
linecount numbers for each commit in the log view. cgit_diff_commit() would
operate without any path limits, and would therefore process the full diff
between the commits shown (which, because of parent rewriting, is not the
same as processing the diff for the commit itself). Additionally, the bottom
commit in the log view would (again, because of parent rewriting) have zero
parents, causing us to process the entire diff between the empty tree and
that commit. Since path limits were not in effect, this would (in large
projects) reports thousands of files and millions of lines changed in that
bottom commit.

This patch fixes the issue by applying the same path limit to
cgit_diff_commit() as is applied to the rest of the log view. The result is
that the filecount/linecount now only reflects the diff as it pertains to
the given path limit.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 30 Sep 2010 20:15:14 +0200
e0c6f237
Add `strict-export` option

This option is used to specify a filename which needs to be present in
the repositories found during `scan-path` processing. By setting this
option to 'git-daemon-export-ok', only repositories explicitly marked
for git daemon export will be included in the cgit configuration.

Signed-off-by: Felix Hanley <felix@seconddrawer.com.au>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Felix Hanley felix@seconddrawer.com.au
Mon, 08 Nov 2010 19:41:13 +0100
49d09d4f
Fix a typo in README, s/ExecCGI/+ExecCGI

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Kamil Kaminski kamilkss@gmail.com
Sun, 10 Oct 2010 23:58:30 -0500
cda1b78f
Append path and branch to atom feed title

Currently all atom feeds for a repository get the same title but they
are actually unique per path and per branch.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Sep 2010 14:25:32 +0100
eca95229
Use committer date for atom feed entry updated element

Committer date reflects the most recent change and is used for ordering
the log page (author date is still available in published element of the
feed entry).

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Chris Mayo aklhfex@gmail.com
Sat, 25 Sep 2010 13:05:52 +0100
69f705cf
Merge branch 'stable'

Conflicts:
	scan-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Nov 2010 16:25:23 +0100
5807fb79
Makefile: add -MP option

Work around errors `make` gives when header files are removed without
the Makefile being updated.

Signed-off-by: Lynn Lin <Lynn.Lin@emc.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Nov 2010 16:13:49 +0100
d41b2ddc
Merge branch 'stable'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 27 Sep 2010 08:03:30 +0200
9043b46f
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 19 Sep 2010 20:58:15 +0200
a9d6e6e6
Merge branch 'ml/bugfix'
Lars Hjemli hjemli@gmail.com
Sun, 19 Sep 2010 19:00:05 +0200
536c7a1e
Merge branch 'lh/section-from-path'

Conflicts:
	scan-tree.c
Lars Hjemli hjemli@gmail.com
Sun, 19 Sep 2010 18:46:17 +0200
e76a1ea4
Merge branch 'lh/readme'
Lars Hjemli hjemli@gmail.com
Sun, 19 Sep 2010 18:43:58 +0200
857696dd
Use GIT-1.7.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 19 Sep 2010 14:00:46 +0200
bf8293d3
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Wed, 01 Sep 2010 12:32:57 +0000
6940b23b
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 29 Aug 2010 17:40:51 +0200
6d7552bc
Use GIT-1.7.2.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 22 Aug 2010 13:29:57 +0200
379e80e3
Support refspecs in about-filter.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jason A. Donenfeld Jason@zx2c4.com
Wed, 04 Aug 2010 00:45:42 +0200
aec9c245
Merge branch 'jd/gitolite'
Lars Hjemli hjemli@gmail.com
Wed, 04 Aug 2010 03:10:29 +0200
e6c960c7
Merge branch 'js/notes'
Lars Hjemli hjemli@gmail.com
Wed, 04 Aug 2010 03:10:24 +0200
6a8f65bf
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 03 Aug 2010 22:52:11 +0200
f9143171
commit-links.sh: Seperate the expressions for filtering commit messages.

This allows for putting descriptions closer to their expressions.  It
should also make it clearer how to apply an expression conditionally.
Jeff Smith whydoubt@yahoo.com
Mon, 05 Jul 2010 22:38:34 -0500
ab610292
Makefile: do not include dependency-file on `make clean`

When envoking clean target, make should not perform the dependency file
generation triggered by include.
Lynn Lin Lin_Lynn@emc.com
Thu, 15 Jul 2010 14:38:06 +0800
6821d8ea
Merge branch 'jh/ignorews'
Lars Hjemli hjemli@gmail.com
Sun, 18 Jul 2010 15:03:30 +0200
5c5d1896
Merge branch 'lh/macros'
Lars Hjemli hjemli@gmail.com
Sun, 18 Jul 2010 15:03:08 +0200
60fcf600
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 13 Jul 2010 21:55:47 +0200
6654d5b7
Merge branch 'lh/range-search'
Lars Hjemli hjemli@gmail.com
Tue, 22 Jun 2010 16:16:24 +0200
6f92f332
Merge branch 'jh/context-lines'

Conflicts:
	cgit.c
	cgit.h
Lars Hjemli hjemli@gmail.com
Tue, 22 Jun 2010 16:16:12 +0200
37a24e4e
Merge branch 'jh/path-limit'

Conflicts:
	cgit.h
	ui-commit.c
Lars Hjemli hjemli@gmail.com
Tue, 22 Jun 2010 16:15:48 +0200
47187b33
Fix style of commit-filter links in commit-subject.

When using the commit-filter functionality to add e.g. bug tracker links to
commit messages, the style of those links is mangled by a CSS directive that
is meant to only apply to decorations that are listed on the commit-subject
line.

Fix this directive to only apply to the decorations.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Fri, 18 Jun 2010 17:56:11 +0200
c8bc3fc0
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:52:42 +0200
c2766deb
Merge branch 'ag/atom-fixes'
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:42:12 +0200
caf0825d
Merge branch 'lh/noweb'
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:41:32 +0200
d6dc3aee
Merge branch 'ml/plain-improvements-part1'
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:40:34 +0200
9af580d8
Merge branch 'sn/subject-link'
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:38:46 +0200
023d9331
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 08 Apr 2010 00:50:20 +0200
ff3a3b4e
ui-tree: add link to plain view for blobs in tree listing

Suggested-by: Robert Weidlich <mail@robertweidlich.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Feb 2010 22:18:00 +0100
c151ce61
Use GIT-1.7.0

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Feb 2010 13:39:53 +0100
067c1804
Merge branch 'html-updates' of git://github.com/MarkLodato/cgit
Lars Hjemli hjemli@gmail.com
Sat, 27 Feb 2010 13:20:27 +0100
71d3ca75
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 27 Feb 2010 12:53:27 +0100
547a64fb
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 12 Dec 2009 12:09:47 +0100
0642435f
Add .tar.xz-snapshot support

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Andreas Wiese aw-devel@instandbesetzt.net
Tue, 08 Dec 2009 22:18:11 +0100
4e75d7c9
Merge branch 'lh/remote-branches'
Lars Hjemli hjemli@gmail.com
Tue, 08 Dec 2009 19:34:30 +0100
f4f6210b
Merge branch 'ro/ssdiff'
Lars Hjemli hjemli@gmail.com
Tue, 08 Dec 2009 19:32:48 +0100
57bb4fdb
Merge branch 'master' of http://op-co.de/cgit
Lars Hjemli hjemli@gmail.com
Tue, 08 Dec 2009 18:31:07 +0100
5c34d96f
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 08 Dec 2009 18:30:02 +0100
e633ccf7
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 07 Nov 2009 18:16:50 +0100
59310ab1
Add NO_OPENSSL option

Linking with OpenSSL is not always desirable. Add NO_OPENSSL option
to use SHA-1 code bundled with Git.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Mikhail Gusarov dottedmag@dottedmag.net
Thu, 29 Oct 2009 03:39:55 +0600
4b1fee00
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 07 Nov 2009 15:35:36 +0100
13032727
ui-shared.c: prettify download links when generated from tag page

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 16 Oct 2009 02:03:32 +0200
322a4bc3
ui-tag: make output more similar to commit view

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 06 Oct 2009 20:33:04 +0200
8cdccac7
ui-tag: add snapshot links

Signed-off-by: Alexey Nezhdanov <snakeru@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Alexey Nezhdanov snakeru@gmail.com
Sun, 27 Sep 2009 23:00:29 +0400
121898e7
Skip leading "/" in url querystring value

Makes it easier to rewrite :)
lighttpd-sandbox: rewrite "/cgit.cgi?url=%{enc:request.path}&%{request.query}";

Signed-off-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Stefan Bühler source@stbuehler.de
Mon, 14 Sep 2009 21:37:13 +0000
9735835c
Fix repolist search links with virtual root

Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Geoff Johnstone qwerty@acm.org
Sun, 20 Sep 2009 11:32:07 +0100
8071e18d
cgitrc.5.txt: Change repo.group to section in example config.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Loui Chang louipc.ist@gmail.com
Mon, 14 Sep 2009 01:21:11 -0400
676d17b2
cgitrc.5.txt: Add mansource and manmanual.

This prevents FIXMEs from appearing.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Loui Chang louipc.ist@gmail.com
Mon, 14 Sep 2009 01:21:10 -0400
27479ac5
CGIT 0.8.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 Sep 2009 22:17:02 +0200
33998c51
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 13 Sep 2009 22:15:38 +0200
92f69409
Merge branch 'lh/repo-scan'
Lars Hjemli hjemli@gmail.com
Sun, 13 Sep 2009 22:02:07 +0200
5f12e45f
Merge branch 'fp/linenumbers'
Lars Hjemli hjemli@gmail.com
Sun, 13 Sep 2009 22:01:52 +0200
45c49d6c
Use GIT-1.6.4.3

Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
Lars Hjemli larsh@slackbox.hjemli.net
Sun, 13 Sep 2009 21:56:45 +0200
670f9909
Merge branch 'stable'
Lars Hjemli larsh@slackbox.hjemli.net
Sun, 06 Sep 2009 19:33:27 +0200
b44c40ea
cgitrc.5.txt: fix description and markup for 'snapshots' option

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 08:00:37 +0200
6445a3ad
scan-tree: split the pw_gecos field at the ',' to get the real name

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Stefan Naewe stefan.naewe@atlas-elektronik.com
Thu, 20 Aug 2009 08:24:51 +0200
0374a76c
cgit.c: fix caching keyed on PATH_INFO with no QUERY_STRING

When generating a hash for caching, ctx.qry.raw is used as key. And
since cgit_parse_url() zero-terminates it's argument (after the repo
path), ctx.qry.raw must xstrdup(ctx.qry.url).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Aug 2009 10:07:51 +0200
e16f1783
Add and use a common readfile() function

This function is used to read the full content of a textfile into a
newly allocated buffer (with zerotermination).

It replaces the earlier readfile() in scan-tree.c (which was rather
error-prone[1]), and is reused by read_agefile() in ui-repolist.c.

1: No checks for EINTR and EAGAIN, fixed-size buffer

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 18 Aug 2009 17:17:41 +0200
523c133e
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 18 Aug 2009 17:21:52 +0200
73b54f7d
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 18 Aug 2009 13:14:11 +0200
cb92d05b
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 17 Aug 2009 10:17:23 +0200
0730ee6e
ui-log.c: handle lightweight tags when printing commit decorations

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 16 Aug 2009 19:52:27 +0200
1bbe04c2
ui-refs.c: improve handling of lightweight tags

When a lightweight tag is referencing a commit object, cgit now uses
the commit date when comparing tag age. Also, the commitdate and author
info is printed in the refs view, making lightweight tags appear similar
to annotated tags.

Signed-off-by: Stefan Bühler <lighttpd@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Stefan Bühler lighttpd@stbuehler.de
Sun, 16 Aug 2009 19:35:18 +0200
ff0ff807
Use GIT-1.6.3.4

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 13 Aug 2009 07:11:41 +0200
2c742d1a
Merge branch 'lh/embedded'
Lars Hjemli hjemli@gmail.com
Tue, 11 Aug 2009 10:12:53 +0200
fcc60562
cgitrc.5.txt: describe where/how cgit will locate cgitrc

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 10 Aug 2009 18:58:29 +0200
92f9b53c
cgit.c: make '/cgit.png' the default value for 'logo' option

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 10 Aug 2009 18:14:12 +0200
4c228e3c
cgit.css: align commit message with subject in expanded log listing

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 10 Aug 2009 18:03:31 +0200
e6cd7121
Add some example filter scripts

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 14:56:23 +0200
db8b8cb9
Merge branch 'lh/about'

Conflicts:
	cgit.h
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:46:34 +0200
db6303b5
Merge branch 'lh/plugins'

Conflicts:
	cgit.c
	cgit.h
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:46:01 +0200
17e3ff42
Merge branch 'lh/mimetypes'
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:45:36 +0200
b4c3562f
Expose file extension in tree lists as class to allow nicer tree styling

Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
Martin Szulecki opensuse@sukimashita.com
Fri, 07 Aug 2009 14:06:02 +0200
2f56e390
Introduce noplainemail option to hide email adresses from spambots

Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
Martin Szulecki opensuse@sukimashita.com
Fri, 07 Aug 2009 14:05:17 +0200
286a9058
Merge branch 'lh/embedded'

Conflicts:
	cgitrc.5.txt
	ui-shared.c
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 12:29:22 +0200
542f6a43
Merge branch 'ml/head-include'
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 12:04:08 +0200
681fdc45
Merge branch 'plain-etag'

Conflicts:
	ui-shared.c
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 11:59:22 +0200
7e5c0485
Merge branch 'rt/plain-binary'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 11:51:57 +0200
fbe091a7
Merge branch 'do/https'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 11:40:25 +0200
e429fb0c
Return http statuscode 404 on unknown branch

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Jun 2009 20:43:08 +0200
45e7fcec
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 15 Mar 2009 09:32:46 +0100
290c2a75
Fix doc-related glitches in Makefile and .gitignore

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 15 Mar 2009 09:27:54 +0100
780d2d98
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 15 Mar 2009 09:06:20 +0100
942a4c20
Merge branch 'asciidoc'
Lars Hjemli hjemli@gmail.com
Sun, 15 Mar 2009 09:05:49 +0100
6063e7b5
ui-tree: escape ascii-text properly in hexdump view

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 12 Feb 2009 11:26:14 +0100
8cc02871
CGIT 0.8.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 01 Feb 2009 19:31:37 +0100
8cbbb644
Use GIT-1.6.1.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 01 Feb 2009 19:30:16 +0100
5e447b1e
Merge branch 'lh/binary'
Lars Hjemli hjemli@gmail.com
Sun, 01 Feb 2009 19:29:47 +0100
0b3c746b
Merge branch 'lh/header'
Lars Hjemli hjemli@gmail.com
Sun, 01 Feb 2009 19:17:52 +0100
d6174b7a
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 29 Jan 2009 22:21:24 +0100
a61871a1
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 23:03:05 +0100
dfc4c82a
Merge branch 'jw/commit-decorations'

Conflicts:
	cgit.css

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 23:00:40 +0100
1fdde95a
Merge branch 'og/tree-view-selection'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 20:21:56 +0100
7710178e
Merge branch 'lh/stats'

Conflicts:
	cgit.c
	cgit.css
	cgit.h
	ui-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 20:16:37 +0100
e78186dc
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Mon, 12 Jan 2009 08:57:23 +0100
31665579
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 22:00:25 +0100
372b4041
Make all tags viewable

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Robin Redeker elmex@ta-sa.org
Sun, 11 Jan 2009 16:25:01 +0100
5176db2e
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 16:38:19 +0100
1383fe3f
Change toggle to more meaningful term

In the log interface, there is a toggle link at the top, but it isn't clear
what's being toggled.  I've changed it to "Expand" and "Collapse" to make it
clear that you are getting more and less information, respectively.

Signed-off-by: Justin Waters <justin.waters@timesys.com>
Justin Waters justin.waters@timesys.com
Fri, 09 Jan 2009 17:35:10 -0500
aa60ae12
Merge branch 'snapshot-fixes'
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 12:22:46 +0100
7f7c1ddd
Merge branch 'lh/mimetypes'
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 12:22:31 +0100
ef688e16
Merge branch 'lh/virtual-root'
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 12:22:19 +0100
d1c48e51
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 12:18:25 +0100
ef2dc552
ui-log: show name-decorations in log output

Commits are now decorated with a clickable 'label' for each ref pointing
at it, similar to how gitweb and gitk displays commit decorations.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 12:16:18 +0100
5164be32
ui-refs: avoid SEGFAULT on lightweight tags

Signed-off-by: Robin Redeker <elmex@ta-sa.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Robin Redeker elmex@ta-sa.org
Sat, 10 Jan 2009 12:44:08 +0100
25f6a1f4
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 06 Jan 2009 21:51:09 +0100
50fbd46c
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Tue, 30 Dec 2008 12:29:50 +0100
06de14d0
Use GIT-1.6.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 26 Dec 2008 11:03:01 +0100
0edf7607
shared.c: future-proof usage of git diff-structures

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 26 Dec 2008 11:02:02 +0100
11456a60
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 12:05:21 +0100
3c32fe07
Merge branch 'full-log'

Conflicts:
	cgit.c
	cgit.h
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 11:37:37 +0100
9c8be943
Merge branch 'lh/sort-repolist'
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 11:35:49 +0100
e5504402
Merge branch 'snapshot-fixes'
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 11:34:48 +0100
3157ea3b
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 11:33:05 +0100
7b5cee65
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Fri, 14 Nov 2008 09:30:28 +0100
9895925d
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 06 Nov 2008 20:47:19 +0100
b8a7eb12
Merge branch 'stable'
Lars Hjemli hjemli@gmail.com
Thu, 06 Nov 2008 19:18:27 +0100
140012d7
CGIT 0.8.1
Lars Hjemli hjemli@gmail.com
Sat, 11 Oct 2008 20:22:57 +0200
8011587e
Merge branch 'stable'

* stable:
  Makefile: enable compilation on uclibc
Lars Hjemli hjemli@gmail.com
Sat, 11 Oct 2008 20:21:17 +0200
ed7ff095
ui-snapshot: add dwimmery

When downloading a snapshot, the snapshot name will often contain the repo
name combined with a tag. This patch tries to exploit this so that the
correct revision is downloaded even if no specific revision is specified.

PS: this only occurs if neither 'h' nor 'id' is specified in the query-
string.

PPS: this also fixes a bug which occurs when trying to download a filename
with an unsupported suffix: it used to try to print an error message to
the user but failed since it didn't prepare the output properly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 11 Oct 2008 20:09:42 +0200
5632ba35
Add cgit_query.nohead flag

This flag is set when no HEAD is specified in the querystring. Currently
it has no users, but it will be used by ui-snapshot to invoke a DWIM-mode
where the revision is extracted from the snapshot name.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 11 Oct 2008 19:05:50 +0200
cb1cc0d8
ui-shared: specify correct css class for summary tab

When introducing cgit_summary_link() in 49ecbbdd I forgot to specify the
css class. This fixes it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 06 Oct 2008 16:00:42 +0200
ae83752b
CGIT 0.8
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 21:23:39 +0200
0071aa86
ui-summary: use html_url_path()

This makes the clone urls be properly escaped.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 21:21:42 +0200
24d4bb30
ui-refs: use cgit_tag_link()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 21:19:05 +0200
cf61ad41
ui-shared: add cgit_tag_link()

This function can be used to generate properly escaped links to the tag
page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 21:18:45 +0200
8b5fc6de
ui-shared: generate proper links in cgit_object_link()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 21:12:08 +0200
2e884f31
ui-shared: use html_url_path() to get properly escaped url in form action

When a repo uses an url with e.g. '#' or '?' characters this needs to be
properly escaped when used as action in a form tag.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 19:25:47 +0200
b7f33786
Use GIT-1.6.0.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 19:19:59 +0200
b9aabf0b
ui-shared: reword the standard page footer

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 19:09:58 +0200
23ffba78
ui-shared: do not print repo name on the "summary" tab

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 19:00:32 +0200
df46123b
Replace cgitrc with cgitrc.5.txt

The new file describes all cgitrc options in a more structured manner then
the cgitrc example file and it might also work as the source for a cgitrc
man page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 18:55:49 +0200
c6bea037
Merge branch 'lh/escape-urls'

* lh/escape-urls:
  ui-repolist + ui-shared: Use cgit_summary_link()
  ui-shared.c: add cgit_summary_link()
  ui-shared.c: use html_url_path() in repolink()
  html.c: add html_url_path
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 17:16:48 +0200
20c895f6
Merge branch 'lh/escape-urls'

* lh/escape-urls:
  ui-shared.c: use html_url_arg()
  html.c: add html_url_arg
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 13:13:33 +0200
204669ff
ui-snapshot.c: specify archiver_args.baselen

The struct member was introduces in git commit d53fe8187c38, but the cgit
testsuite failed to detect that cgit always generated archives without
prefixes, i.e. the result from cgit_repobasename was ignored.

This fixes the bug and the testsuite.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 13:13:03 +0200
f82b1940
ui-diff: make diffstat header a link to the full diff

When printing a path-filtered diff it wasn't obvious how to get back to
the full diff (clicking the 'diff' tab would do this). Making the diffstat
heading into a link seems to improve the usability.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 23 Sep 2008 17:54:45 +0200
04619c9b
ui-diff: fix links from diffstat

The links in the diffstat is supposed to work as a filter for the diff,
but this only worked when a single rev was supplied, i.e. the filtered
diff was always against the parent of the specified rev.

With this patch it is now possible to use the diffstat as a 'filter menu'
for urls like http://hjemli.net/git/cgit/diff/?id=v0.7.2&id2=v0.7.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 23 Sep 2008 17:47:26 +0200
06e14dc6
Add LDFLAGS to makefile.

This will allow for creating static builds which is useful for chrooted
environments.

Signed-off-by: Harley Laue <losinggeneration@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Harley Laue losinggeneration@gmail.com
Thu, 18 Sep 2008 21:06:18 -0500
dd80ef59
ui-repolist: enable filtering of repos by path

If a repo url is specified but no exact match is found in the list of
repos the url will now be used as a prefix-filter.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 14 Sep 2008 20:18:10 +0200
93397a76
Add support for --scan-tree=<path> option to cgit

This option makes cgit scan a directory tree looking for git repositories,
generating suitable definitions for a cgitrc file on stdout.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 15 Sep 2008 00:07:12 +0200
e154edd8
Teach cgit how to use PATH_INFO

This commit makes cgit use the cgi variables SCRIPT_NAME and PATH_INFO
when virtual-root is unspecified in cgitrc and no url-parameter is
specified on the querystring. This has two nice effects:

* Virtual urls works out of the box, no more need for rewrite-rules in httpd.
* Virtual urls with special querystring characters are handled correctly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 09 Aug 2008 21:11:41 +0200
a30453a5
Merge branch 'lh/parsing'

* lh/parsing:
  ui-tag: show the taggers email
  parsing.c: be prepared for unexpected content in commit/tag objects
Lars Hjemli hjemli@gmail.com
Mon, 15 Sep 2008 22:41:25 +0200
91fd1eca
Merge branch 'ew/http_host'

* ew/http_host:
  use Host: header to generate cgit_hosturl
Lars Hjemli hjemli@gmail.com
Mon, 15 Sep 2008 21:47:14 +0200
b2876513
Update Makefile to use GIT-1.6.0.1

When updating the git submodule to 1.6.0.1 (and 1.6.0), the Makefile was
left behind. This fixes it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 03 Sep 2008 00:18:09 +0200
687fb6d8
Use GIT-1.6.0.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 02 Sep 2008 01:06:27 +0200
135b2311
ui-plain: handle subdirectories

The callback from read_tree_recursive just needs to check the type of
each tree entry; if it's a dir we want to continue scanning, if it's a
regular file we'll assume it's the one we requested.

And while at it, remove some stray fprintfs.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 02 Sep 2008 00:53:04 +0200
04a6f3b0
Use GIT-1.6.0
Lars Hjemli hjemli@gmail.com
Mon, 01 Sep 2008 22:50:35 +0200
d532c4d1
Merge branch 'lh/plain'

* lh/plain:
  Supply status description to html_status()
  ui-tree: link to plain view instead of blob view
  Implement plain view
Lars Hjemli hjemli@gmail.com
Mon, 01 Sep 2008 22:40:55 +0200
288d502b
Merge branch 'lh/clone'

* lh/clone:
  Add support for cloning over http

Conflicts:
	cmd.c
Lars Hjemli hjemli@gmail.com
Mon, 01 Sep 2008 22:40:24 +0200
2cecf839
cache.c: use %zd for off_t argument

Signed-off-by: Lars Hjemli <hjemli@gmail>
Lars Hjemli hjemli@gmail.com
Sun, 10 Aug 2008 09:24:24 +0200
7fa088e9
Use GIT-1.6.0.rc1

Now that rc1 is released as a tarball `make get-git` should start working
again.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 19:08:19 +0200
8c2a1367
Makefile: Git dependency, take 3

In commit a1266edfe the build instructions for the git libs where moved
to their real targets, which in turn depended on the phony target `git`.
But since `git` is an actual directory in cgit the git libs wouldn't be
recompiled when needed.

So with this patch (third time lucky), cgit is declared to depend on the
really phony target `libgit` and the build instructions for `libgit` is
to unconditionally rebuild git/libgit.a and git/xdiff/lib.a.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 18:52:27 +0200
e352a013
Merge branch 'lh/atom'
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 09:50:10 +0200
3c71f597
cgitrc: explain new local-time option

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Stefan Naewe stefan.naewe@atlas-elektronik.com
Tue, 05 Aug 2008 09:20:07 +0200
0f0ab148
Added `local-time` option to cgitrc

When `local-time` is set, commit, tag and patch timestamps will be printed
in the servers timezone. Also, regardless of the value of `local-time`,
these timestamps will now always show the timezone.

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Stefan Naewe stefan.naewe@atlas-elektronik.com
Fri, 01 Aug 2008 14:54:38 +0200
a1266edf
Makefile: another take on git dependency rules

When building cgit we depend on xdiff/lib.a and libgit.a in the git
directory, but the previous attempt on describing this dependency
failed since the build instructions for the libs was placed under the
phony `git` target.

This patch fixes the issue by moving the build instructions to their
real targets. It also makes it clear that only the `cgit` target
depends on the git binaries (since they're only used during linking).

And while at it, the patch also cleans up the list of phony targets.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 01 Aug 2008 01:25:51 +0200
952f4ece
Modify default value for a few cgitrc options

The default max-length used when printing commit messages and repo
descriptions can be increased due to the new layout (no sidebar).

Also, on the repo summary page I believe it makes sense to only show the
ten most recent branches and tags by default, just as it makes sense to
show the ten most recent commit messages for the active branch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 27 Jul 2008 12:58:37 +0200
25c84326
Be prepared for empty repositories

Before this patch, cgit would segfault on repositories with no refs.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 27 Jul 2008 12:32:08 +0200
2d6ee032
ui-shared: show repo owner along with description

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 27 Jul 2008 12:22:16 +0200
78af25cc
ui-summary: show clone urls

If either repo.clone-url or clone-prefix is specified in cgitrc, all
space-separated values in the config option is printed as a possible
clone url on the repo summary page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 27 Jul 2008 11:54:06 +0200
50989d3b
Makefile: remove the `distclean` and `emptycache` targets

The `distclean` was hardly useful while the `emptycache` was actively harmful.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 Jul 2008 20:06:16 +0200
a75968df
Makefile: do not touch the git objects with `make clean`

I've been avoiding `make clean` for a long time due to its eagerness to kill
all the git objectfiles.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 Jul 2008 19:58:37 +0200
bb7485e8
Makefile: fix git dependency rules

The objectfiles depends unconditionally on some specific git binaries while
those git binaries depends on the phony `git` target and this patch seems to
get these dependencies spelled out correctly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 Jul 2008 19:30:06 +0200
f49ea2c9
tests/Makefile: not everyone has `.` in $PATH

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 Jul 2008 19:01:31 +0200
566f92b2
Adjust to new calling convention for read_tree_recursive()

In GIT-1.6.0, read_tree_recursive takes an extra void pointer for callback
data. We might want to use this to avoid some global variables, but for now
lets just make sure that we can still compile.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli larsh@hatman.(none)
Mon, 21 Jul 2008 10:10:48 +0200
d2eb4fdd
Use GIT-1.6.0-rc0
Lars Hjemli larsh@hatman.(none)
Mon, 21 Jul 2008 09:57:25 +0200
502865a5
Add a favicon option to cgitrc

This option is used to specify a shortcut icon on all cgit pages.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli larsh@hatman.(none)
Sat, 19 Jul 2008 20:40:30 +0200
de5e9281
Add support for including a footer on all pages

The new cgitrc option `footer` can be used to include a html-file which
replaces the standard 'generated by cgit' message at the bottom of each
page.

Suggested-by: Peter Danenberg <pcd@wikitex.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 26 Jun 2008 13:53:30 +0200
29b37e97
Merge branch 'master' of git://git.klever.net/patchwork/cgit

* 'master' of git://git.klever.net/patchwork/cgit:
  allow specification of directly linked blobs mimetypes
  allow blob extract blobs by head/path combination
Lars Hjemli hjemli@gmail.com
Thu, 26 Jun 2008 12:54:44 +0200
833b0d27
Use GIT-1.5.6
Lars Hjemli hjemli@gmail.com
Wed, 25 Jun 2008 17:39:25 +0200
e6b635c2
Added root-desc to default configuration.

Signed-off-by: Harley Laue <losinggeneration@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Harley Laue losinggeneration@gmail.com
Tue, 20 May 2008 19:08:21 -0500
08a8757f
ui-tree.c: avoid peeking at GITLINK objects

When an object in the tree has GITLINK mode-bits we don't need to get any
more info about that particular object (and trying to get more info about
it will usually generate an annoying warning on stderr since the object
typically doesn't exist in the repo anyways).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 20 May 2008 22:32:22 +0200
dd7c1725
cache.c: fix error checking in print_slot()

The change to print_slot() in cdc6b2f8e7a8d43dcfe0475a9d3498333ea686b8 made
the function return correct errno for read errors while ignoring write errors,
which is not what was intended. This patch tries to rectify things.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 20 May 2008 17:56:47 +0200
af2e7561
cache.c: do not ignore errors from print_slot()

If print_slot() fails, the client will be served an inferior response.
This patch makes sure that such an error will be returned to main(), which
in turn will try to inform about the error in the response itself.

The error is also printed to the cache_log, i.e. stderr, which will make
the error message appear in error_log (atleast when httpd==apache).

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 23:59:11 +0200
cdc6b2f8
cache.c: use xread()/xwrite() from libgit

These functions handles EINTR/EAGAIN errors during read/write operations,
which is something cache.c didn't.

While at it, fix a bug in print_slot() where errors during reading from the
cache slot might go by unnoticed.

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 23:26:05 +0200
d402811b
cache.c: make all io-related functions return errno on error

We'll need proper return-values from these functions to make the cache
behave correctly (which includes giving proper error messages).

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 23:16:50 +0200
6102bcfc
cache.c: read(2) returns -1 on error, not 0

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 23:10:05 +0200
c3de425a
Use GIT-1.5.5.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 21:40:28 +0200
8907f2a0
Include commit-id in link from diff-stat

This fixes a regression created by fe1230dece81450004d02fa8a470f8dab8f7fdd9,
and modifies a test to avoid future regressions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 21:21:32 +0200
502d5759
ui-commit: handle root commits

Both cgit_print_diff() and cgit_diff_tree() handles root commits nicely,
but cgit_print_commit() forgot to check the case of 0 parents.

This fixes it, and adds tests to avoid future regressions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 May 2008 21:09:26 +0200
17890d00
Add link to index page from repo header, remove page name

This makes it more obvious how to get back to the index, especially when the
config option `logo-link` is used. And the page name displayed in the header
provided no extra information. It only consumed space and deserved to die.

While at it, make sure that the different parts of the header doesn't wrap
when horizontal space is limited.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 May 2008 12:44:20 +0200
aa3c4486
Add footer with page creation time and cgit version on all pages

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 May 2008 11:07:41 +0200
c6078b8b
Add a pager on the repolist

This enables a pager on the repolist which restricts the number of entries
displayed per page, controlled by the new option `max-repo-count` (default
value 50).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 May 2008 10:54:39 +0200
141f1c3e
Add cgit_index_link() function with support for offset

This function will be used to build a pager in ui-repolist.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 May 2008 10:37:02 +0200
e19683be
Merge branch 'lh/cache'

* lh/cache:
  Add page 'ls_cache'
  Redesign the caching layer
Lars Hjemli hjemli@gmail.com
Sat, 03 May 2008 10:10:07 +0200
112b2080
Print an error if filename is not found in html_include.

Normally when html_include cannot open the file it fails silently and
things can be a bit hard to figure out from just looking at apache's
log. This will be beneficial for those initially setting up their server
with cgit.

Signed-off-by: Harley Laue <losinggeneration@aim.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Harley Laue losinggeneration@aim.com
Tue, 29 Apr 2008 17:59:53 +0200
905dbaef
Merge branch 'lh/about'

* lh/about:
  Add 'about site' and 'about repo' pages
  Prepare for 'about site' page / add 'root-readme' option to cgitrc
  Make it possible for a single cmd to work both with and without a repo
  Re-enable 'index-info' and add support for 'root-desc' in cgitrc
  Move included header-file out of repolist table
  Prepare for 'about repo' page
Lars Hjemli hjemli@gmail.com
Tue, 29 Apr 2008 01:13:08 +0200
d188ed4f
ui-diff: remove test on object type

By removing the test for commit objects it's now possible to specify a
tag name for the id query-string parameter (it already worked for id2).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 24 Apr 2008 23:40:51 +0200
fe1230de
Integrate diffstat with diff

This creates a generic diffstat function in ui-diff, which then is
invoked from cgit_print_diff with the result that both commit and diff-
view gets a diffstat.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 24 Apr 2008 23:32:02 +0200
9ec5cd79
Fix commitdiff annoyance

Someone were a bit sloppy when the commitdiff got included 'inline' in
commit 89aa3c0d0a4c6d9885272602005975b763ea1604. This patch deletes a
stray `)` and makes sure the diffstat summary `<div>` is closed before
the full diff is printed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 17 Apr 2008 18:29:50 +0200
3cfcb086
Cleanup page header

Fix some invalid html, remove dead code.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 Apr 2008 00:00:11 +0200
78031f92
Fix search in repo index even if caching is enabled

The repository index page needed to include the querystring in the cache
filename.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 Apr 2008 23:07:52 +0200
e9a7042b
Make a few more columns in repolist and log view clickable

Less mouse movement is nice.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 Apr 2008 22:23:48 +0200
5764fe95
Make branches, tags and log play better together in the summary view

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 Apr 2008 22:13:38 +0200
35d19bbb
Fix more css ugliness

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 Apr 2008 22:10:33 +0200
2ee1238c
cgit.css: set form margins

According to the css2 spec, htmlforms have 1.12em top and bottom margins. That
doesn't play well with the placement of the search form, so lets force it to
use 0em margins.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 Apr 2008 10:17:33 +0200
adf61225
Fix css font-family

When the sidebar was introduced in v0.7 the default font-family property
got messed up, but this commit should fix the issue.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 Apr 2008 10:00:59 +0200
76ba6287
Merge branch 'lh/layout'

* lh/layout:
  Make repository search case insensitive
  Remove 'patch' link from tab, add to commit view
  Implement minimal freetext search in the repolist
  More layout fixes
  Minor fixup in tree-view css
  Reintroduce the branch switcher
  Add fixed link to index page from repo header
  Include diff in commit view
  Replace sidebar/logo
Lars Hjemli hjemli@gmail.com
Sun, 13 Apr 2008 12:48:44 +0200
4a842288
Use GIT-1.5.5
Lars Hjemli hjemli@gmail.com
Wed, 09 Apr 2008 18:05:30 +0200
fa4dfee5
Don't specify mimetype in ui-blob.c

But be sure to specify correct filename. This way, the client can hopefully
guess a sensible mimetype based on the filename suffix, and cgit can ignore
the issue altogether.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 25 Mar 2008 02:43:51 +0100
23296ad6
Merge branch 'lh/cleanup'

* lh/cleanup: (21 commits)
  Reset ctx.repo to NULL when the config parser is finished
  Move cgit_parse_query() from parsing.c to html.c as http_parse_querystring()
  Move function for configfile parsing into configfile.[ch]
  Add cache.h
  Remove global and obsolete cgit_cmd
  Makefile: copy the QUIET constructs from the Makefile in git.git
  Move cgit_version from shared.c to cgit.c
  Makefile: autobuild dependency rules
  Initial Makefile cleanup
  Move non-generic functions from shared.c to cgit.c
  Add ui-shared.h
  Add separate header-files for each page/view
  Refactor snapshot support
  Add command dispatcher
  Remove obsolete cacheitem parameter to ui-functions
  Add struct cgit_page to cgit_context
  Introduce html.h
  Improve initialization of git directory
  Move cgit_repo into cgit_context
  Add all config variables into struct cgit_context
  ...
Lars Hjemli hjemli@gmail.com
Tue, 08 Apr 2008 21:29:21 +0200
e2a44cf0
Use GIT-1.5.5-rc2
Lars Hjemli hjemli@gmail.com
Tue, 01 Apr 2008 00:59:55 +0200
cb41af16
Use GIT-1.5.5.rc1
Lars Hjemli hjemli@gmail.com
Sun, 23 Mar 2008 11:36:38 +0100
e01f1403
Fix segfault in patch view for root commit

The code for patch view assumed the current commit would always have a parent,
which made cgit segfault when that wasn't the case.

This fixes the bug and adds a test-script for patch view which includes a test
for the inital commit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 17 Mar 2008 23:13:16 +0100
0537a7d1
Use GIT-1.5.4.4
Lars Hjemli hjemli@gmail.com
Mon, 17 Mar 2008 22:59:09 +0100
538cb4a7
tests/setup.sh: cleanup test script output and logging

Log the complete output from each test-script in test-output.log and tell the
user about the logfile when a test-script fails.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 24 Feb 2008 19:53:51 +0100
20cdffd5
t0010-validate.sh: return on cgit errors

The earlier segfault in cgit passed by unnoticed by this test-script due to
the pipe between cgit and sed.

There might be a more elegant solution to this problem, but my shellscript-
foo is weak.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 24 Feb 2008 19:43:46 +0100
b44b02a9
Make output from `make test` more readable

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 24 Feb 2008 16:05:58 +0100
e5ca46bf
Brown paper bag: don't use `grep -v`

For some inexplicable reason I'd gotten the semantics of `grep -v` totally
backwards, thinking it somehow would make the exitcode from grep indicate
the non-match of the specified pattern.

This fixes the broken tests and gives me a valuable lession about shell
programming at the same time.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 24 Feb 2008 15:35:52 +0100
19134112
Add regression-test for description-less repos

The segfault fixed in commit eacde43d7184452e1fdc90b982b531f1f5239923 was
triggered when the html-functions manipulated string literals. One callpatch
which could trigger the bug is in ui-repolist.c when repo descriptions are
passed to html_ntxt(): if a repo is lacking a description, the literal
string "[no description]" is used.

This patch changes test/setup.sh such that the first repo has no description,
and adds tests for both "[no description]" and "the bar repo" (description
of the other repo) to tests/t0101-index.sh, which should be enought to catch
regressions in these functions.

Noticed-by: Hiroki Hattori <seagull.kamome@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 24 Feb 2008 15:27:33 +0100
e0572c39
Merge branch 'stable'

* stable:
  Fix segfault

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 23 Feb 2008 20:13:57 +0100
e5ed227e
Use GIT-1.5.4.1
Lars Hjemli hjemli@gmail.com
Sat, 16 Feb 2008 11:22:06 +0100
2106c96c
Use GIT-1.5.4
Lars Hjemli hjemli@gmail.com
Sat, 02 Feb 2008 08:55:09 +0100
ac195ce7
Use GIT-1.5.4.rc5
Lars Hjemli hjemli@gmail.com
Mon, 28 Jan 2008 21:18:28 +0100
776200b1
Use GIT-1.5.4.rc4
Lars Hjemli hjemli@gmail.com
Sun, 13 Jan 2008 19:16:23 +0100
2122c696
Merge branch 'stable'

* stable:
  CGIT 0.7.2
  Use GIT-1.5.3.8
  Compare string lengths when parsing the snapshot mask
  Default repo description to "[no description]"
Lars Hjemli hjemli@gmail.com
Sun, 13 Jan 2008 18:34:37 +0100
f39c3c99
Check for NULL-subject in patch view

While at it, make sure the commit message ends with a '\n'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 18 Dec 2007 08:26:50 +0000
f80ff37a
Handle missing default branch and error out on invalid branch names

When no branch is specified and the repository does not have a default branch,
use the first branch.

Also, print sensible errormessages when the repository does not contain any
branches and when invalid branchnames are specified.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 04 Jan 2008 13:43:40 +0100
620bb3e5
Add plain patch view

The new view mimics the output from `git format-patch`, making it possible
to cherry-pick directly from cgit with something like `curl $url | git am`.

Inspired by a patch to `git-apply` by Mike Hommey:
  http://thread.gmane.org/gmane.comp.version-control.git/67611/focus=67610

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 10 Dec 2007 21:47:29 +0100
afcdd083
Add support for automatic and custom clone urls

This adds support for two new parameters to cgitrc: clone-prefix and
repo.clone-url.

If clone-prefix is specified, all repos will get a clone url printed in the
sidebar; the url is generated by clone-prefix + repo.url.

Additionally, each repo can specify repo.clone-url which will override any
such auto-generated url.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Dec 2007 01:49:38 +0100
dabb34af
Merge branch 'stable'

* stable:
  Handle missing timestamp in commit/tag objects
  Set commit date on snapshot contents
Lars Hjemli hjemli@gmail.com
Sun, 02 Dec 2007 22:28:37 +0100
e8e67218
Add cell-spacing in html

There are some browsers which don't support the border-spacing property

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 16 Nov 2007 10:28:29 +0100
6ef637e0
Use tables for page layout

It feels like the Right Thing, and it fixes some rendering problems in a
much used webbrowser.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 16 Nov 2007 09:52:03 +0100
fd90d282
Gimp my logo

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 16 Nov 2007 09:51:35 +0100
d267d88c
Add support for "robots" meta-tag

With this change, cgit will start to generate the "robots" meta-tag, using
a default value of "index, nofollow".

The default value can be modified with a new cgitrc variable, "robots".

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 21:57:21 +0100
1b7c5b2e
Generate valid html for "downloads" menu header

Noticed-by: http://validator.w3.org
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 13:44:39 +0100
a7cf406c
Merge branch 'lh/testsuite'

* lh/testsuite:
  Set commit date on snapshot contents
  Fix html error detected by test-suite
  Create initial testsuite
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 13:17:13 +0100
ab21082c
Merge branch 'stable'

* stable:
  CGIT 0.7.1
  Makefile install: include cgit.png, do not empty cache

Conflicts:

	Makefile
Lars Hjemli hjemli@gmail.com
Fri, 09 Nov 2007 13:52:48 +0100
86d6dfa9
Minor css tweaks

Don't specify border and background color for input controls, reduce font-
size of heading in sidebar.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 09 Nov 2007 13:19:56 +0100
6e54bd00
Merge branch 'stable'

* stable:
  Support "/" as virtual-root
Lars Hjemli hjemli@gmail.com
Thu, 08 Nov 2007 12:22:39 +0100
1ae41a0d
Makefile: link with libiconv if NEEDS_LIBICONV is defined

This seems to be needed to compile on cygwin.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 06 Nov 2007 09:35:07 +0100
55ac326e
Merge branch 'iconv-rebased' of http://x2a.org/pub/git/cgit

* 'iconv-rebased' of http://x2a.org/pub/git/cgit:
  Use utf8::reencode_string from git
  Convert subject and message with iconv_msg.
  Add iconv_msg function.
  Set msg_encoding according to the header.
  Add commit->msg_encoding, allocate msg dynamicly.
Lars Hjemli hjemli@gmail.com
Tue, 06 Nov 2007 00:38:18 +0100
d04c4734
Show lines changed as -n/+m in shortlogs

This is way more informative than the total number of changed lines.

Suggested-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 06 Nov 2007 00:35:12 +0100
72ede125
Don't show the the branch selector button if javascript is enabled

Suggested-by: Olivier Ramonat <olivier@ramonat.fr>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 14:17:58 +0100
601c76eb
Do not require javascript-enabled clients

A simple submit-button is all that's required to make the branch selector
drop-down work on any client, so lets add one.

Noticed-by: Olivier Ramonat <olivier@ramonat.fr>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 14:05:12 +0100
e36365c6
CGIT 0.7
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 11:35:55 +0100
c2f75225
Use GIT-1.5.3.5

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 11:33:54 +0100
1e4ff4dc
Don't include current SHA1 in 'log' menu-item

This ensures that the menu-item always prints the log for the active branch.
Predictability is good.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 11:33:28 +0100
cda7194e
Don't include current path in menu links

The menu-links are a lot more predictable this way.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 11:23:47 +0100
68cf9b4f
Fix search form action/hidden fields

The search form didn't properly honor the current path, so this commit
fixes cgit_fileurl() and add_hidden_formfields() to make the issue go
away.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 11:15:56 +0100
51140311
Add search parameters to cgit_log_link

This makes the [prev] and [next] links work correctly on search results.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Nov 2007 10:42:37 +0100
df203a29
Fix typo in css

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Shunichi Fuji palglowr@gmail.com
Sat, 03 Nov 2007 09:36:09 +0100
0c8e184e
Change the cgit layout

This modifies and hopefully improves the layout of all cgit pages:

  * Remove the header from all pages and replace it with a sidebar;
    most pages have sufficient width but many needs more height.

  * Add a dropdown-box to switch between branches, using a one-liner
    javascript to reload the current page in context of the selected branch.

  * Include refs found below refs/archives in the sidebar, appearing as a
    set of menuitems below a 'download' heading.

  * Include the brand new cgit logo

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 30 Oct 2007 10:47:38 +0100
10ac7ad1
Add config param 'index-info'

This parameter will be used to include a html file in the upcoming sidebar
on the index page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 30 Oct 2007 10:39:59 +0100
fc5880fa
Teach cgit_object_link() about tag objects

This makes random tag links more helpfull, e.g. when a branch head references
a tag object, link to the tag page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Oct 2007 15:40:47 +0100
cbcdbcf2
Make print_branch() handle refs not pointing at commits

The master branch of stable/linux-2.6.20 currently references a tag
object, which makes print_branch() die with a segfault. This teaches
print_branch() to handle such cases more gracefully.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Oct 2007 15:36:18 +0100
68ca032d
Teach log search about --grep, --author and --committer

This makes the log searching more explicit, using a dropdown box to specify
the commit field to match against.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Oct 2007 15:23:00 +0100
6ec5f36f
Add html_option() function

This is a generic function used to output html "option" tags.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Oct 2007 12:08:45 +0100
0c8dd9c4
Merge branch 'stable'

* stable:
  cgit_parse_commit(): Add missing call to xstrdup()
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 13:55:44 +0200
b4d4a25a
Cleanup code introduced by the filter-refs topic

The functions used to print branches and tags were only half-done and
somewhat confused. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 13:34:17 +0200
dd0f27eb
Merge branch 'filter-refs'

* filter-refs:
  Add links to the new refs page from summary page
  Add support for refs view
  Make cgit_print_branches()/cgit_print_tags() external
  Add descriptions of summary-branches and summary-tags to cgitrc
  Add support for config param summary-branches
  Move logic for age comparision from cmp_tag_age into cmp_age()
  Add support for config param summary-tags
  Sort tags by age
  Use reflist to print tag info
  Use reflist to print branch info
  Add functions and types for ref lists
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:55:10 +0200
47bae9f5
Merge branch 'stable'

* stable:
  Skip unknown header fields when parsing tags and commits
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 09:15:41 +0200
f214118c
Merge branch 'stable'

* stable:
  correct typo in CSS
Lars Hjemli hjemli@gmail.com
Fri, 05 Oct 2007 16:20:13 +0200
9dda602c
Merge branch 'stable'

* stable:
  Use git-1.5.3.3
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 12:51:04 +0200
271829f2
cgit.css: make diff headers more visible

This modifies the background color of diff headers to make them easier to
spot.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 12:41:29 +0200
e238ebe1
ui-diff: add links to pre- and postversion of blobs

Each diff header now links to the old and new version of each file

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 12:30:29 +0200
97aec649
gen-version.sh: don't sed the output from git describe

Replacing '-' with '.' makes the version name slightly confusing, so lets
stick with the unmodified output of git describe.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 12:01:51 +0200
7e1af8ad
css: remove the annoying tr:hover rule for diffstat

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 12:09:07 +0200
0ec8791c
ui-commit.c: link to diff instead of tree from diffstat

This makes each entry in the diffstat link to a path-restricted diff.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 11:54:01 +0200
1a6025b7
Add prefix parameter to cgit_print_diff()

This allows a diff to be restricted to the path prefix specified in the url.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 11:46:38 +0200
f527a57c
Add prefix parameter to cgit_diff_tree()

This paramter can be used to restrict a diff to the specified path prefix.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 11:42:19 +0200
98fcf722
Add support for a renamelimit option in cgitrc

This option can be used to override the default rename-limit in git.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Sep 2007 23:52:30 +0200
b65aa5d1
cgit v0.6.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Sep 2007 01:04:54 +0200
08b67765
Upgrade to GIT 1.5.3.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Sep 2007 01:03:25 +0200
4e40d850
Use trim_end() to remove trailing slashes

All urls and paths read from cgitrc needs to be 'normalized', i.e. get any
trailing slashes removed, and the trim_end() function works out nice for
this purpose.

Removing the trailing slashes also happens to fix the case where the virtual
root should be a single slash; that case used to require specifying the full
hostname (including the http:// prefix), but now it can simply be specified
as /.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Sep 2007 00:56:53 +0200
0835ffef
Remove a few compiler warnings

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Sep 2007 00:21:47 +0200
6df9c702
Add cgit.conf to .gitignore, remove *~

Not having cgit.conf in .gitignore is a bug, while having *~ is a personal
preference.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Sep 2007 00:11:03 +0200
ff7a3948
ui-tree: show last line of blob

The last line in a blob was never printed by ui-tree::print_object(), which
was particularly annoying when the blob missed a final newline. This fixes
the issue.

Noticed-by: <mkraai@beckman.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Sep 2007 00:00:06 +0200
63d5f5ea
ui-tree: specify parameter position for all htmlf formats

The GNU C library manual tells us that behavior is undefined if only
some formats has a specification for the parameter position.

Noticed-by: <mkraai@beckman.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 19 Sep 2007 23:46:59 +0200
7921572f
fixed typo in cgitrc

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Fri, 14 Sep 2007 19:28:09 +0200
0602d8c4
Improve the sample cgitrc file

Added and documented missing cgitrc parameters, improved documentation
for virtual-root, added examples for repositories with a working
directory.

[lh:sligthly modified/extended]

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Chris Pickel sfiera@macports.org
Sat, 08 Sep 2007 19:37:43 -0400
4beecc9a
cgit v0.6.2
Lars Hjemli hjemli@gmail.com
Sat, 08 Sep 2007 19:10:37 +0200
6bfed7d2
Revert part of "Makefile: add support for DESTDIR"

This removes my editing on the patch received by Chris Pickel, as I didn't
understand the purpose of DESTDIR.

Noticed-by: Chris Pickel <sfiera@macports.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 08 Sep 2007 18:42:55 +0200
152c5e2a
Revert "Makefile: add missing references to DESTDIR"

This reverts commit fa31c5ed4839575c3ef3f6f0823fc2b4af47dbfd, as I
totally misunderstood the purpose of DESTDIR.

Noticed-by: Chris Pickel <sfiera@macports.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 08 Sep 2007 18:38:10 +0200
af38d656
cgit v0.6.1
Lars Hjemli hjemli@gmail.com
Sat, 08 Sep 2007 15:53:02 +0200
fa31c5ed
Makefile: add missing references to DESTDIR

When cgit is built it needs to get CGIT_CONFIG and CGIT_CACHE_ROOT prefix
with DESTDIR.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 08 Sep 2007 11:59:04 +0200
898f5f89
Make cgit honor CACHE_ROOT as defined in Makefile

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Chris Pickel sfiera@macports.org
Sat, 08 Sep 2007 11:39:44 +0200
97ded7c1
Makefile: add support for DESTDIR

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Chris Pickel sfiera@macports.org
Sat, 08 Sep 2007 11:34:11 +0200
96a24212
cgit v0.6

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 04 Sep 2007 11:54:37 +0200
bd8e8a3d
Update README

Add new build instructions, extend the "Missing features" section and add
a note about patches/email address of the author.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 04 Sep 2007 11:49:40 +0200
0de21a8d
Set xdemitconf_t.findfunc=NULL

This function-pointer was introduced in git v1.5.3-rc0-42-gf258475. It
needs to have a value, and setting it to NULL triggers the old behaviour
for selecting hunk headers.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 04 Sep 2007 11:04:47 +0200
ff133969
Merge branch 'jo/dirlink'

* jo/dirlink:
  Rename dirlink to gitlink.

Conflicts:

	ui-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Sep 2007 23:00:06 +0200
4e7e8bf9
Use git-1.5.3 as submodule

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Sep 2007 22:58:02 +0200
79f0c10d
Delete submodules.sh and prepare for using git-submodule

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Sep 2007 22:54:51 +0200
95eaf273
Makefile: add target "get-git"

The new target downloads a suitable git.git tarball from kernel.org and
unpacks it in the git directory.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Sep 2007 22:42:54 +0200
e8920b52
Rewrite the makefile + gen-version.sh

The old files were simply broken, hopefully the new ones will work out
somewhat better.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Sep 2007 21:52:14 +0200
1221adbb
ui-snapshot: whitespace/formatting cleanup

Introduce a #define for number of snapshot archive entries, move all decls
to function entrypoint, remove some trailing whitespace and reformat a few
lines.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 23 Jul 2007 22:51:45 +0200
43291e41
Make ui-tag.c generate valid xhtml

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 23 Jul 2007 01:42:49 +0200
f405d0bf
Add support for line number in url fragment

With this change, urls like http://hjemli.net/git/cgit/tree/ui-tree.c#43 can
be used to jump directly to the specified line number.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 23 Jul 2007 00:46:15 +0200
eb45342e
cgit_print_snapshot_links: use url to specify snapshot name

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 23 Jul 2007 00:11:15 +0200
1d4aaff6
Merge branch 'master' of git://git.klever.net/patchwork/cgit

* 'master' of git://git.klever.net/patchwork/cgit:
  link raw blob from tree file view
  fix: changed view link to blob in summary.
  allow selective enabling of snapshots
  shorten snapshot names to repo basename
  introduce cgit_repobasename
  added snapshot filename to the link
  add plain uncompressed tar snapshort format
  introduced .tar.bz2 snapshots
  compress .tar.gz using gzip as a filter
  added a chk_non_negative check
  css: adjust vertical-align of commit info th cells
  add support for snapshot tarballs

Conflicts:

	ui-summary.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 22 Jul 2007 23:57:48 +0200
4e9107ab
Add ui-tag.c

This file implements the tag-command, i.e. printing of annotated tags.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 22 Jul 2007 23:42:55 +0200
71ebcbe2
make gen-version.sh run even if . is not in PATH

Signed-off-by: Michael Krelin <hacker@klever.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Michael Krelin hacker@klever.net
Mon, 02 Jul 2007 02:29:11 +0200
51f65478
make config adjustable via env variable CGIT_CONFIG

Signed-off-by: Michael Krelin <hacker@klever.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Michael Krelin hacker@klever.net
Mon, 02 Jul 2007 02:29:12 +0200
16a3d277
Merge branch 'lh/menu'

* lh/menu:
  Add ofs argument to cgit_log_link and use it in ui-log.c
  Add trim_end() and use it to remove trailing slashes from repo paths
  Do not include current path in the "tree" menu link
  Add setting to enable/disable extra links on index page
  Change S/L/T to summary/log/tree
  Change "files" to "tree"
  Include querystring as part of cached filename for repo summary page
  Add more menuitems on repo pages
Lars Hjemli hjemli@gmail.com
Fri, 29 Jun 2007 20:32:08 +0200
f6925035
Add version info from git-describe

A new script, gen-version.sh, is now invoked from 'make version' to generate
the file VERSION. This file contains a version identifier generated by
git-describe and is included in the Makefile.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 18 Jun 2007 09:42:10 +0200
4a0be586
Add cgit_diff_link()

This adds a new function used to generate links to the diff page and uses
it everywhere such links appear (expect for single files in the diffstat
displayed on the commit page: this is now a link to the tree page).

The updated diff-page now expects zero, one or two revision specifiers, in
parameters head, id and id2. Id defaults to head unless otherwise specified,
while head (as usual) defaults to repo.defbranch. If id2 isn't specified, it
defaults to the first parent of id1.

The most important change is of course that now all repo pages (summary, log,
tree, commit and diff) has support for passing on the current branch and
revision, i.e. the road is now open for a 'static' menu with links to all
of these pages.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 18:12:03 +0200
faaca447
ui-commit: use cgit_commit_link() for parent links

This replaces the old cgit_pageurl() function with the brand new
cgit_commit_link() function, making parent links in commit view preserve
the current branch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 15:44:22 +0200
cd79c168
ui-log: honor id=sha1 on querystring

This teaches ui-log to prefer id=sha1 and fallback to h=rev if no id-
parameter is specified. With this change, summary, log, commit and tree
views now passes current branch using h parameter and current revision
using id parameter.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 14:58:45 +0200
42a7eb9c
Add cgit_commit_link() + support for id=sha1 to commit view

This adds a function to generate links to the commit page and extends said
page to use id from querystring as primary revision specified (fallback to
h).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 14:53:02 +0200
48c487d7
Add git_log_link() and fix bug in generic repolink function

The generic repolink function compared head with cgit_query_head, which
almost always would be the same pointer. The test now compares with
repo.defbranch, which is the wanted behavour.

Bug discovered while adding cgit_log_link(), so this commit also contain
that change.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 13:57:51 +0200
426032f7
ui-tree: html/css cleanup

Various fixes to make html and css more "clean". The only visible change
is the link to file/directory log: it is now printed as "L" (for Log)
instead of "H" (for History).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 13:17:00 +0200
486c87ec
ui-shared: use strcmp() to compare strings

Somehow a couple of pointer comparisions crept into the new repolink()
and cgit_tree_link() functions. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 12:58:59 +0200
44947bfc
Add and use cgit_tree_link()

This creates a new function used to generate links to 'tree' page and uses
the function everywhere a link to the 'tree' page is generated.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Jun 2007 01:23:08 +0200
f91b9696
ui-tree: make blob viewer generate valid html

A leftover '</td></tr>' made ui-tree generate invalid html for blob
content. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Jun 2007 21:35:58 +0200
ffc69736
ui-tree: unify with ui-view, use path to select tree/blob

This teaches ui-tree to show both trees and blobs, thereby making ui-view
superfluous. At the same time, ui-tree is extended to honour the specified
path instead of requiering a tree/blob sha1.
Lars Hjemli hjemli@gmail.com
Sat, 16 Jun 2007 20:20:42 +0200
849f0f0f
cgit.css: make it validate

This fixes a few validation-issues in the css.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 07 Jun 2007 00:43:07 +0200
c83db796
ui-diff: close td/tr/table properly

The previous commit fixed the diff-view when two trees where specified on
the querystring (sha1/sha2) but made the generated html invalid when only
a commit sha1 is specified. This fixes it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Jun 2007 23:02:40 +0200
4a6201e3
ui-diff: emit table/tr/td at better locations

This fixes a bug which made the diff-link for each parent of a commit
output a diff without correct styles.

It also adds an error-message if the head commit specified on the querystring
isn't a valid commit object.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 05 Jun 2007 11:44:47 +0200
51a960a3
Implemented configurable HEAD shortlog on summary page.

This mirrors similiar functionality in gitweb. After clicking on
project on projectlist you will immediatelly see quick summary
of last N commits on HEAD.

[lh: changed from HEAD to cgit_query_head]

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ondrej Jirman ondrej.jirman@zonio.net
Sat, 26 May 2007 03:33:41 +0200
6130231e
Check for NULL commit buffer in cgit_parse_commit()

This can be NULL, so try not to segfault.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ondrej Jirman ondrej.jirman@zonio.net
Sat, 26 May 2007 03:27:49 +0200
a922615d
Add option to disable pager to cgit_print_log().

This is needed for upcomming shortlog on summary page
patch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ondrej Jirman ondrej.jirman@zonio.net
Sat, 26 May 2007 03:26:14 +0200
3ce6fc16
Handle single-line and empty commit subjects

If commit object ends with \0 after subject line, then info->subject
was not set.

This commit fixes this and also sets subject to ** empty ** if it
would otherwise be empty, so that there is something to click on.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ondrej Jirman ondrej.jirman@zonio.net
Sat, 26 May 2007 02:19:38 +0200
1a63cfcc
Use &amp; instead of & in URLs.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ondrej Jirman ondrej.jirman@zonio.net
Sat, 26 May 2007 01:15:10 +0200
0928d882
Fixed unexpected tags in html output.

At least those that were catched by tidy.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ondrej Jirman ondrej.jirman@zonio.net
Sat, 26 May 2007 01:14:25 +0200
2a09c0d1
cgit v0.5

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 24 May 2007 00:18:16 +0200
7dc99a4b
Bad html: it's nice to add alt-attributes

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 24 May 2007 00:08:36 +0200
ef473df0
Bad html: <form> should have an action-attribute

Don't know how the href-attribute got in there...

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 24 May 2007 00:06:25 +0200
62dcc05c
Close a <tr> properly

No reason to generate illegal html.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 24 May 2007 00:02:18 +0200
bbcdc290
Add repo.readme parameter

This parameter can be used to specify a repo-specific includefile, which will
then be printed on the summary page for the repo.

If the parametervalue is a not an absolute path, it is taken to be relative
to repo.path.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 23 May 2007 22:46:54 +0200
25da3f76
Remove unused variable from ui-repolist.c:read_agefile()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 23 May 2007 19:22:20 +0200
57f6a8bf
Show time since last change on index page

When creating the index page, an optional file can be scanned per repository
to obtain a timestamp for last modification within the repo. If such a file
cannot be found, st_mtime for repo.defbranch is used instead.

This information is then printed in a new column, "Idle", using the new
function cgit_print_age().

The new parameter "repo.agefile" can be used to specify (globally) a relative
path to scan (default value is "info/web/last-modified").

The content of the "last-modified" file can be generated by the post-receive
hook with a command like this:

	git-for-each-ref --format="%(committerdate)" --sort=-committerdate \
	--count=1 > $GIT_DIR/info/web/last-modified

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 May 2007 23:25:25 +0200
237ef7b0
Use cgit_print_age() on summary and log pages

Update the pages to show relative dates instead of yyyy-mm-dd hh:mm:ss

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 May 2007 23:15:36 +0200
5db39170
Add cgit_print_age() function

This function can be used to print relative dates, just as in gitweb. Next
step will be to actually use the new function.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 22 May 2007 23:08:46 +0200
3b86b44f
css: make column headings bold

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 21 May 2007 00:29:11 +0200
0b8b6a31
Make frontpage friendlier

This is an attempt to make the index page more usable by changing how
repo groups and repo links are displayed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 21 May 2007 00:14:28 +0200
271ac5a7
Merge branch 'repogroups'

* repogroups:
  Adjust apperance of repogroup headers
  Don't highlight repogroup headings
  Teach cgit how to group repositories by category
Lars Hjemli hjemli@gmail.com
Sun, 20 May 2007 22:13:17 +0200
dc3ac3f7
Merge branch 'virtual-url'

* virtual-url:
  Don't be fooled by trailing '/' in url-parameter
  cache_safe_filename() needs more buffers
  Enable url=value querystring parameter
  Add lookup-function for valid repo commands
  Move cgit_get_repoinfo into shared.c
Lars Hjemli hjemli@gmail.com
Sun, 20 May 2007 22:09:55 +0200
977a0b17
Merge branch 'index-header'

* index-header:
  Teach cgit howto include an external file on index page.
  Add html_include()
Lars Hjemli hjemli@gmail.com
Sun, 20 May 2007 14:33:59 +0200
d4dbfdfb
Use git-1.5.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 20 May 2007 13:14:36 +0200
08cc2e5f
Remove unused extern declarations from cgit.h

Some unused declarations from the early days of cgit are removed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 22:50:11 +0200
e189344a
Add knobs to enable/disable files/lines changed in log view

These columns can cause lots of IO on the server, so add settings to
explicitly enable them. Also, add per repo settings to optionally disable
the columns if sitewide enabled.

While at it, do not allow repo.snapshot to enable snapshots if the global
setting is disabled.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 13:55:52 +0200
c1ad6cb7
Restrict length of repo description on repolist page

If any repo has a very long description, all repos suffer since the
repo-links in the right-most column gets pushed out of sight.

Fix it by introducing max-repodesc-length parameter in cgitrc, and default
to 60 chars.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 10:45:45 +0200
f4f1339f
Don't die when diffing trees with subprojects

The subprojects needs special handling, since they refer to objects
which normally won't exist in the refering repository.

Fix some extended header bugs and missing features while at it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 04:21:06 +0200
d82c08a0
Do not wrap filemode column in diffstat table

The diffstat looks rather ugly when the filemode is wrapped to one
char per line, so lets force it to not wrap.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 03:30:57 +0200
8f6f8c34
Add C D L and T links to index page

These are of course Commit, Diff, Log and Tree pages, all accessed w.o.
specifying refname or sha1.

Sadly, the layout is neither pretty nor accessible.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 02:12:06 +0200
72346996
Make git_pageurl handle NULL querystrings

This is suddenly useful after the repo.defbranch-related changes.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 02:06:28 +0200
97de8f05
Add support for tree listing via h parameter

This makes the tree page benefit from repo.defbranch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 01:38:02 +0200
dff894d1
Add link to commitdiff below diffstat

This link is a lot easier to locate than the links to the right of the
parent entries.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 01:16:56 +0200
f9ff7df6
Add support for commitdiff via h parameter

The commitdiff will be generated against the first parent, and the
diff page also gets the benefit of repo.defbranch.

Cleaned up some bad whitespace in cgit.h while at it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 00:58:35 +0200
a2ddc104
Change commit-view to expect h parameter, not id

The change makes the commit-page benefit from repo.defbranch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 00:26:23 +0200
b28b105e
Enable default value for head parameter

Pages which expect head to be specified in the querystring can now be
given a default value, configurable per repository (via repo.defbranch,
which defaults to "master").

Currently, only the log page actually works without parameters, but the
defbranch is bound to be exploited.

This also removes some dead code from shared.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 16 May 2007 00:14:51 +0200
47a81c77
Restrict deep nesting of configfiles

There is no point in restricting the number of included config-
files, but there is a point in restricting the nestinglevel
of configfiles: to avoid recursive inclusions. This is easily
achieved by decrementing the static nesting-variable upon exit
from cgit_read_config().

Also fix some whitespace breakage.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 23:28:40 +0200
ad3b39d3
Include cgit.conf in Makefile

This allows persistent overrides of Makefile settings without touching
the Makefile.

Suggested in a patch by Kristian Høgsberg <krh@bitplanet.net>

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 18:38:31 +0200
c94afaac
ui-diff: show /dev/null as filename for add/delete

The diff headers showed an invalid filename when a patch created or
deleted a file. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 09:27:27 +0200
e903011c
Use tables and css to create the diffstat graph, fix scaling

There was no need to use image-files for the graphs, so lets drop them.
At the same time, fix scaling of the graphs so that the full width is
used only if atleast 100 LOC are changed in one of the files.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 02:13:11 +0200
cfd2aa07
Do not alter incoming sha1 when handling the download refs.

The code used to overwrite the const sha1 parameter just to avoid declaring
an extra variable. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 01:05:39 +0200
ea2831f1
Don't hardcode urls when SCRIPT_NAME is available

Also, let the makefile define the name of the installed cgi and
use that definition as a default value for cgit_script_name variable.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 00:48:31 +0200
6fb7d09f
ui-shared.c: fix whitespace breakage

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 00:22:03 +0200
495e3967
Show tag heading even if first tag is of the lightweight kind

The tag printing code waited for valid tags before printing the
table heading, but forgot to count unannotated tags. This fixes it.

Noticed by Kristian Høgsberg <krh@bitplanet.net>

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 15 May 2007 00:07:37 +0200
9927e63f
Specify static storage class for file-local declarations

Also fix some whitespace issues while at it.

Noticed by Kristian Høgsberg <krh@bitplanet.net>

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 23:58:29 +0200
5ec6e02b
Add include-parameter to config files

This parameter can be used to include another config-file, like
a standalone repository listing.

Suggested in a patch by Kristian Høgsberg <krh@bitplanet.net>

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 23:40:33 +0200
9ecde656
Let makefile override the configfile location

Pass CGIT_CONFIG from makefile during build, to enable stuff like

  make CGIT_CONFIG=/var/cgit/cgit.conf

Noticed by Kristian Høgsberg <krh@bitplanet.net>

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 23:09:49 +0200
5b94c96a
cgit.c: fix whitespace breakage
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 22:58:01 +0200
a342ac6b
cgit.css: try to make diffs look a little bit nicer

This makes the diffview look more like 'git-diff' in a terminal.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 18:31:05 +0200
a1a0cd8b
cgit.css: try do make diffstat a little bit nicer

I'm still no webdesigner, but this seems to be a more pleasant "visual
experience".

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 18:08:03 +0200
9fb53af2
Add log filtering by path and link to it from tree view

This enables path-filtering in log-view, and adds a link per entry in
tree-view to show the log for each file/directory.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 14 May 2007 11:10:59 +0200
4fdf571c
cgit v0.4

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 23:28:19 +0200
6a8749d3
Add commitdiff between commit and each of it's parent

A link is added next to each parent of a commit, leading to the new
diff-functionality in ui-diff.c.

Also added support for a path-parameter to filelevel diffs accessed via the
diffstat.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 23:13:12 +0200
8a3685bc
Add graphical diffstat to commit view

The diffstat is calculated against the leftmost parent of the commit. This
gives nice information for "normal" merges while octopus merges are less
than optimal, so the diffstat isn't calculated for those merges.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 22:25:14 +0200
c6cf3a42
Add max-commit-count parameter to cgitrc

This enabled customizing number of commits shown per page in log view. It
also changes the default from 100 to 50, mainly due to the more cpu
intensive log pages (number of files/lines changed) but also since 100
log messages requires excessive scrolling.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 17:15:06 +0200
80e577c3
Show number of changed lines in log view

Use the new file-diff interface to calculate number of changed lines
per commit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 17:03:27 +0200
38a0f9cd
Simplify ui-diff.c using the new file-level diff interface

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 14:21:46 +0200
c4ef6679
Add standard interface for file diff functions

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 14:21:19 +0200
48dc0034
Show number of changed files in log view

This uses the new tree-diff functions to calculate number of files
changed per commit.

Also fix some whitespace issues.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 11:27:46 +0200
ae4c1ee1
Use standard tree-diff function when showing diffstat for single commit

Remove unneeded code from ui-commit.c and replace with call to standard
diff-functions.

Also fix some whitespace issues.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 11:26:23 +0200
1b49de3c
Add shared diff-handling functions

This adds a standard interface for tree diffing.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 May 2007 11:24:23 +0200
f5af0beb
css: fix bad rendering in Internet Explorer

The layout-tables used border-collapse:separate, which maked all pages look
really bad in IE. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 May 2007 00:29:37 +0200
9f48df63
Add links to enable downloading of tagged blobs

All tags below refs/archives are shown on the repo summary page as
download links. The links referes to the tagged objects, using the
tag name as filename for download.

This can be used to add shortcuts for release tarballs, documentation
and other blobs stored in the object database, especially blobs that
are not reachable during cloning.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 11 May 2007 23:44:42 +0200
f596d10d
Makefile: add support for building w.o. preinstalled git

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 11 May 2007 20:41:14 +0200
dad80d1f
Tag release v0.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 11 May 2007 12:15:44 +0200
5a217ed3
Update README with submodule build info

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 11 May 2007 12:13:15 +0200
ded9393b
Add submodule links in tree listing

When a submodule occurs in a tree, generate a link to show the
module/commit. The link is specified as a sprintf string in /etc/cgitrc,
using parameters 'module-link' and 'repo.module-link'. This should probably
be extended with repo.module-link.$path.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 11 May 2007 12:12:48 +0200
cc1dbd1b
Add submodules.sh and use it during builds

This adds a shell script which can be be used to initialize, list and
update submodules in a git repository. It reads the file .gitmodules
to find a mapping between submodule path and repository url for the
initial clone of all submodules.

The script is used during cgit builds to enable automatic download and
checkout of the git git repository.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 10 May 2007 11:25:12 +0200
e7434438
Added git as a submodule

This commit adds the subdirectory 'git' as a submodule containing
the git git repository, but doesn't add support for automatically
cloning the submodule.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 10 May 2007 08:50:49 +0200
ca8eb8fc
Add support for downloading single blobs

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 09 May 2007 00:48:09 +0200
7250a154
ui-view: show pathname if specified in querystring

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 08 May 2007 23:52:56 +0200
61c3ca97
Update to libgit 1.5.2-rc2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 08 May 2007 22:40:59 +0200
66cacd05
Layout update
Lars Hjemli hjemli@gmail.com
Sat, 17 Feb 2007 13:46:18 +0100
ac70cb47
Make snapshot feature configurable

Snapshots can now be enabled/disabled by default for all repositories in
cgitrc with param "snapshots". Additionally, any repo can override the
default setting with param "repo.snapshots".

By default, no snapshotting is enabled.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 08 Feb 2007 14:47:56 +0100
ab2ab95f
Add support for snapshots

Make a link from the commit viewer to a snapshot of the corresponding tree.

Currently only zip-format is supported.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 08 Feb 2007 13:53:13 +0100
14d360df
cgit v0.2

Main changes since v0.1:
  -list tags in repo summary
  -allow search in log-view
  -read repository paths from cgitrc

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 05 Feb 2007 00:21:06 +0100
c52e8413
Add support for prefix and gitsrc arguments to 'make'

This should improve the installation a little, especially since the new
options are mentioned in the README. Also, add a make-rule to build the
git binaries if necessary + a dependency between cgit and libgit.a.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 04 Feb 2007 23:57:34 +0100
74b0db95
Update cgitrc template

Make the descriptions more helpfull.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 04 Feb 2007 23:24:08 +0100
8fb2f056
Add support for lightweight tags

There is nothing bad about a tag that has no tag-object, but the old code
didn't handle such tags correctly. Fix it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 04 Feb 2007 22:55:19 +0100
ce1c7336
Read repo-info from /etc/cgitrc

This makes cgit read all repo-info from the configfile, instead of scanning for
possible git-dirs below a common root path. This is primarily done to get
better security (separate physical path from logical repo-name).

In /etc/cgitrc each repo is registered with the following keys:

repo.url
repo.name
repo.path
repo.desc
repo.owner

Note:

*Required keys are repo.url and repo.path, all others are optional
*Each occurrence of repo.url starts a new repository registration
*Default value for repo.name is taken from repo.url
*The value of repo.url cannot contain characters with special meaning for
 urls (i.e. one of /?%&), while repo.name can contain anything.

Example:

repo.url=cgit-pub
repo.name=cgit/public
repo.path=/pub/git/cgit
repo.desc=My public cgit repo
repo.owner=Lars Hjemli

repo.url=cgit-priv
repo.name=cgit/private
repo.path=/home/larsh/src/cgit/.git
repo.desc=My private cgit repo
repo.owner=Lars Hjemli

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Feb 2007 15:02:55 +0100
ebd7b0fb
Do not die if tag has no message

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Feb 2007 16:11:41 +0100
bb3e7950
Fix search for non-virtual urls

When cgit don't use virtual urls, the current repo and page
url parameters must be included in the search form as hidden
input fields.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 03 Feb 2007 13:08:21 +0100
66414b68
Update README with install/config information

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Jan 2007 13:18:23 +0100
3c388a3b
Add template for /etc/cgitrc

This doubles as documentation of the parameteres :)

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Jan 2007 12:52:14 +0100
7dd50c98
Add parameter to adjust max message length in log listings

The parameter "max-message-length" can be specified in cgitrc, default value
is 60.

This affects the log message shown in repo summary and shortlog.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Jan 2007 12:17:03 +0100
d8b0cca2
Set explicit font size

This might be bad style, but cgit really needed smaller fonts.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Jan 2007 12:01:21 +0100
8596cda7
Change global document layout

Use a document-wide table for the main layout

Signed-off-by: Lars Hjemli <larsh@slaptop.hjemli.net>
Lars Hjemli larsh@slaptop.hjemli.net
Sun, 28 Jan 2007 11:33:55 +0100
4a9dea5c
Unified install path

Install all files into single directory

Signed-off-by: Lars Hjemli <larsh@slaptop.hjemli.net>
Lars Hjemli larsh@slaptop.hjemli.net
Sun, 28 Jan 2007 11:31:57 +0100
777faf7e
Cleanup table listings

Make the output for <table class='list'> a bit nicer

Signed-off-by: Lars Hjemli <larsh@slaptop.hjemli.net>
Lars Hjemli larsh@slaptop.hjemli.net
Sun, 28 Jan 2007 00:39:26 +0100
447025f6
Enable building with debuginfo

Add -g to CFLAGS when running make with DEBUG=1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 17 Jan 2007 01:13:05 +0100
23734c5a
Extend repo summary with tag list

Show all tags in the repo below the branch list.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 17 Jan 2007 01:10:39 +0100
a69061fd
Add function cgit_parse_tag()

Teach cgit how to extract author info from a tag.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 17 Jan 2007 01:09:51 +0100
06c81d6f
Add some more decls from git (cache.h, tag.h)

This is in preparation for extended tag support in cgit

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 17 Jan 2007 01:07:31 +0100
66091f93
Handle empty/malformed commit messages

An empty commit message would trigger a segfault in the current
cgit_parse_commit().

Also, make sure that all char-pointers are properly initialized.
Lars Hjemli hjemli@gmail.com
Tue, 16 Jan 2007 18:41:01 +0100
5cd2bf7e
WIP: add paths/backlinks to tree/blobview
Lars Hjemli hjemli@gmail.com
Fri, 12 Jan 2007 00:46:17 +0100
2c2047ff
Remove troublesome chars from cachefile names

Add a funtion cache_safe_filename() which replaces possibly bad filename
characters with '_'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 12 Jan 2007 00:24:35 +0100
83a5f35a
Move cache_prepare() to cgit

This moves some cgit-specific stuff away from cache.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 12 Jan 2007 00:00:15 +0100
f98e7268
Use long instead of int when converting from TTL to seconds

Just to be really, really sure about embarrasing overflow settings

Signed-off-by: Lars Hjemli <larsh@hal-2004.(none)>
Lars Hjemli larsh@hal-2004.(none)
Fri, 05 Jan 2007 18:20:23 +0100
a6a11125
Use TTL-settings even in nocache mode

In nocace mode an uninitialized ttl-setting was used to generate http-Expires
header. Fix it.

Signed-off-by: Lars Hjemli <larsh@hal-2004.(none)>
Lars Hjemli larsh@hal-2004.(none)
Fri, 05 Jan 2007 18:18:58 +0100
52e605ca
Handle %xx encoding in querystring

Convert valid %xx expressions in querystring to ascii, ignore invalid
expressions (i.e. eat the three characters %xx).

Signed-off-by: Lars Hjemli <larsh@hal-2004.(none)>
Lars Hjemli larsh@hal-2004.(none)
Thu, 04 Jan 2007 16:53:03 +0100
05b13194
Handle '+' in querystring

Translate '+' to ' ' in querystring parser (still doesn't handle %xx)

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 28 Dec 2006 02:51:46 +0100
732d68d2
Add basic log filtering

This enables case-insensitive grep on logentris using the new search box

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 28 Dec 2006 02:45:28 +0100
e39d738c
Add generic support for search box in page header

This adds the ability to show a search box in any pageheader with correct href and
hidden form data, but does not enable the box on any pages.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 28 Dec 2006 02:01:49 +0100
27cd3b2a
Test for NULL-pointers in html_txt() and friends

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 28 Dec 2006 01:54:43 +0100
c43f1246
Minor style fixes

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 22 Dec 2006 01:44:32 +0100
2efee09a
Add missing diff-link in ui-commit.c

Gaah.

This should have been a part of 36aba00273e7af1b94bf8c5dd5068709d983d01e

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 22 Dec 2006 01:38:37 +0100
9d8d9b61
Only show first 80 characters of commit subject in log and summary

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 22 Dec 2006 00:58:18 +0100
378cae63
Add missing ttl-options in config

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 22 Dec 2006 00:56:02 +0100
8e495b07
cgit 0.1

With a working diff, it really has all the basics.

Next steps will be to make it more usable and less ugly :)

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 21 Dec 2006 00:53:03 +0100
40dea525
Let make know that ui-diff.c depends on xdiff.h

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 21 Dec 2006 00:47:05 +0100
36aba002
Add basic diff view

Finally, xdiff is used to show per-file diffs via commit view.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 20 Dec 2006 22:48:27 +0100
a5304286
Use html_filemode in ui-tree.c

No reason to show "100644" when we can show "-rw-r--r--"

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Dec 2006 23:55:53 +0100
fb6e5869
Don't show new and old filemode for added/removed files

It gives us no extra info whatsoever to show "----------" for either new
or old mode, it's just noise (especially since we now show the "old"
filemode for deleted files)

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Dec 2006 23:30:55 +0100
6cb326c8
Show list of modified files in ui-commit.c

Compare current commit with 1.parent, and for each affected file display
current filemode, old filemode if changed, current filename and source
filename if it was a copy/rename.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 17 Dec 2006 23:07:28 +0100
9c5229ea
Reformat code to avoid excessive line lengths

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 19:35:31 +0100
aaa24bdd
Add cgit_free_commitinfo() and use where needed

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 14:58:20 +0100
fa82b03e
Simplify ui-commit.c

Replace the call to lookup_commit() with a call to lookup_commit_reference,
since it handles reading and parsing of the commit object internally.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 14:46:05 +0100
8960d267
Show emails and timestamps in ui-commit.c

Use the extra info found in commitinfo struct when generating commit
view.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 14:28:26 +0100
77078ba7
Teach commit parser about author/committer email + timestamp

We want all four of these when showing a commit, so save them in the
commitinfo struct.

Btw: There's probably no good reason to save committer timestamp since
it's already available in commit->date. But it doesn't hurt us either,
and it makes the parser look more complete, so we just do it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 14:25:41 +0100
7c849d94
Allow relative paths for cgit_cache_root

Make sure we chdir(2) back to the original getcwd(2) when a page
has been generated. Also, if the cgit_cache_root do not exist,
try to create it.

This is a feature intended to ease testing/debugging.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 13:55:58 +0100
61245ad1
Add cache-root option to /cgit/rc

Somehow, this option was forgotten when parsing the configfile.

Add it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 13:43:01 +0100
521dc7a4
Add argument parsing + switch for uncached operation

This adds support for the following options to cgit:
  --root=<path>
  --cache=<path>
  --nocache
  --query=<querystring>
  --repo=<reponame>
  --page=<pagename>
  --head=<branchname>
  --sha1=<sha1>
  --ofs=<number>

On startup, /etc/cgitrc is parsed, followed by argument parsing and
finally querystring parsing.

If --nocache is specified (or set in /etc/gitrc), caching is disabled and
cgit instead generates pages to stdout.

The combined effect of these two changes makes testing/debugging a lot
less painfull.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 13:33:32 +0100
a1a79998
Add head comment to shared.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 01:14:01 +0100
6c14f5e4
Add head comment to ui-commit.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 01:11:55 +0100
f516218d
gitweb ripoff: set tr:hover to highligt current row

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 01:00:12 +0100
0de2055b
Make repo header a link to summary page

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 00:49:37 +0100
148fb962
Move cgit_print_date into ui-shared, reuse in ui-summary

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 00:33:28 +0100
9a8f8865
Add ui-commit.c + misc ui cleanups

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Dec 2006 00:19:56 +0100
2101e26f
Add a common commit parser

Make a better commit parser, replacing the ugly one in ui-log.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 15 Dec 2006 18:17:36 +0100
420712ac
Add simple pager to log page

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 14 Dec 2006 00:40:34 +0100
c45b8178
Add separate makefile-rule to clear current cache

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 13 Dec 2006 14:39:41 +0100
dcef257d
Remove implementation details from README

Let README describe the "bigger picture" instead.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 13 Dec 2006 02:06:29 +0100
9c2e863e
Small layout adjustments to summary and blob view

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 13 Dec 2006 00:36:22 +0100
06fe0c2f
Add display of tree content w/ui-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 13 Dec 2006 00:13:27 +0100
58d04f65
cache_lock: do xstrdup/free on lockfile

Since fmt() uses 8 alternating static buffers, and cache_lock might call
cache_create_dirs() multiple times, which in turn might call fmt() twice,
after four iterations lockfile would be overwritten by a cachedirectory
path.

In worst case, this could cause the cachedirectory to be unlinked and replaced
by a cachefile.

Fix: use xstrdup() on the result from fmt() before assigning to lockfile, and
call free(lockfile) before exit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 12 Dec 2006 10:16:41 +0100
fbaf1171
Don't truncate valid cachefiles

An embarrassing thinko in cgit_check_cache() would truncate valid cachefiles
in the following situation:
  1) process A notices a missing/expired cachefile
  2) process B gets scheduled, locks, fills and unlocks the cachefile
  3) process A gets scheduled, locks the cachefile, notices that the cachefile
     now exist/is not expired anymore, and continues to overwrite it with an
     empty lockfile.

Thanks to Linus for noticing (again).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 22:53:50 +0100
44923f89
Move global variables + callback functions into shared.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 17:25:41 +0100
df631193
Move functions for generic object output into ui-view.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 17:12:26 +0100
d14c5f6d
Move log-functions into ui-log.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 17:04:19 +0100
1418034e
Move repo summary functions into ui-summary.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 16:55:07 +0100
74620f12
Move functions for repolist output into ui-repolist.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 16:48:03 +0100
5a106eb0
Move common output-functions into ui-shared.c

While at it, replace the cgit_[lib_]error constants with a proper function

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 16:38:30 +0100
51ada4fd
Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 16:11:40 +0100
318d1063
Avoid infinite loops in caching layer

Add a global variable, cgit_max_lock_attemps, to avoid the possibility of
infinite loops when failing to acquire a lockfile. This could happen on
broken setups or under crazy server load.

Incidentally, this also fixes a lurking bug in cache_lock() where an
uninitialized returnvalue was used.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 12:10:12 +0100
a581ed8d
Let 'make install' clear all cachefiles

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 11:23:05 +0100
f5069d88
Fix cache algorithm loophole

This closes the door for unneccessary calls to cgit_fill_cache().

Noticed by Linus.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 11 Dec 2006 09:57:58 +0100
76827d86
Add version identifier in generated files

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 10 Dec 2006 23:50:16 +0100
7640d90b
Add license file and copyright notices

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 10 Dec 2006 22:41:14 +0100
25105d7e
Add caching infrastructure

This enables internal caching of page output.

Page requests are split into four groups:
  1) repo listing (front page)
  2) repo summary
  3) repo pages w/symbolic references in query string
  4) repo pages w/constant sha1's in query string

Each group has a TTL specified in minutes. When a page is requested, a cached
filename is stat(2)'ed and st_mtime is compared to time(2). If TTL has expired
(or the file didn't exist), the cached file is regenerated.

When generating a cached file, locking is used to avoid parallell processing
of the request. If multiple processes tries to aquire the same lock, the ones
who fail to get the lock serves the (expired) cached file. If the cached file
don't exist, the process instead calls sched_yield(2) before restarting the
request processing.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 10 Dec 2006 22:31:36 +0100
856c026e
Add .gitignore

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 09 Dec 2006 22:21:43 +0100
c76a52be
Replace useless make rules with generic $(OBJECTS) dependency

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 09 Dec 2006 15:29:05 +0100
0d169ada
Import cgit prototype from git tree

This enables basic cgit functionality, using libgit.a and xdiff/lib.a from
git + a custom "git.h" + openssl for sha1 routines.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 09 Dec 2006 15:18:17 +0100
de69ce02
Teach cgit howto include an external file on index page.

The new parameter index-header can be used to name an external file
which will be included verbatim at the top of the index page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 19 May 2007 00:00:25 +0200
5e75128a
Add html_include()

This is a function used to include external htmlfiles in cgit-
generated pages.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 23:56:10 +0200
3de63b26
Don't be fooled by trailing '/' in url-parameter

cgit_parse_url() didn't check if the path-part of urls contained a
real path or just a trailing slash. This made the log-page die since
the path filtering supplied an invalid path argument. This fixes it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 13:06:45 +0200
72fa5c63
cache_safe_filename() needs more buffers

The single static buffer makes it impossible to use the result of two
different calls to this function simultaneously. Fix it by using 4
buffers.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 03:54:15 +0200
30ccdcaa
Enable url=value querystring parameter

This makes is possible to use repo-urls like '/pub/scm/git/git.git' and
even add path specifications, like '/pub/scm/git/git.git/log/documentation'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 03:00:54 +0200
43d40f2b
Add lookup-function for valid repo commands

This will be usefull when parsing url arguments.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 00:50:46 +0200
305414df
Move cgit_get_repoinfo into shared.c

This function will be usefull when parsing url arguments.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 00:47:47 +0200
7b39144a
Adjust apperance of repogroup headers

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 20 May 2007 22:12:54 +0200
2aef89e5
Don't highlight repogroup headings

Specify class='nohover' to avoid highlighting this row.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 23:17:09 +0200
5877c49f
Teach cgit how to group repositories by category

The new parameter 'repo.group' is used to set the repository group
for the following repositores. Whenever this parameter changes value,
a subheading is generated in the index page (printing the current value
of repo.group).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 18 May 2007 22:48:22 +0200
103940fe
Add ofs argument to cgit_log_link and use it in ui-log.c

This fixes a bug in the prev/next links on the log page: when on the default
branch the links to prev/next page would contain h=(null).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 29 Jun 2007 20:27:41 +0200
382805ee
Add trim_end() and use it to remove trailing slashes from repo paths

The new function removes all trailing instances of an arbitrary character
from a copy of the supplied char array. This is then used to remove any
trailing slashes from cgit_query_path.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 26 Jun 2007 18:04:31 +0200
42e459bb
Do not include current path in the "tree" menu link

When generating the menu links on repo pages the tree link included the
current path. This made the link pretty useless whenever the current path
was set so this commit just passes NULL instead.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 26 Jun 2007 17:32:03 +0200
0d05bca5
Add setting to enable/disable extra links on index page

The summary/log/tree links displayed for each repository on the index
page lost some of their purpose when the header menu was added, so this
commit introduces the parameter 'enable-index-links' which must be set
to 1 to enable these links.

Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 19 Jun 2007 00:56:40 +0200
a215bf46
Change S/L/T to summary/log/tree

In yet another attempt at better usability, the cryptic S/L/T links are
changed to show their full name.

Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 18 Jun 2007 22:12:09 +0200
1f34fb9d
Change "files" to "tree"

This renames the menu link and the shortcut on the repo index page from
the strange "files" to the more gittish "tree".

Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 18 Jun 2007 22:06:00 +0200
7d6ee4ee
Include querystring as part of cached filename for repo summary page

When adding support for the h parameter to the summary page (passing current
branch between pages), the builtin cache returned basically random results
for summary page since the cached filename didn't honour the querystring.

This fixes the issue for now, but someday it might be worthwhile to generate
'canonical' filenames in the cache for all pages, i.e. something a bit more
clever than just including the querystring.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 18 Jun 2007 21:17:24 +0200
b8be028a
Add more menuitems on repo pages

In an attempt to get better usability, a set of 'semistatic' menuitems
are added to the page header on all pages except the repository index.

The menuitems (summary, log, files, commit and diff) honours the current
branch and revision. To switch the current branch one can use the branch
links on the summary page.

The backlink to the repository index page is now available by clicking
the static page heading.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 18 Jun 2007 00:18:42 +0200
d6b01dac
link raw blob from tree file view

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 19:51:47 +0200
bbd4a144
fix: changed view link to blob in summary.

 might not be the best way, but should suffice for now that view command isn't
 handled in any way

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 19:35:39 +0200
dc3c9b5b
allow selective enabling of snapshots

 snapshot configuration parameter now can be a
 space/slash/comma/colon/semicolon/pipe-separated list of snaphot suffixes as
 listed in ui-snapshot.c

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 18:00:53 +0200
97c025ae
shorten snapshot names to repo basename

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 15:29:55 +0200
1cb8bedf
introduce cgit_repobasename

 that shortens reponame stripping any directories and .git suffixes, that is
 turning 'dir/repo.git/' or 'dir/repo/.git/' or alikes into mere 'repo'.

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 15:24:07 +0200
0df096f6
added snapshot filename to the link

 - changed cgit_pageurl into cgit_fileurl with the filename parameter
 - rewritten cgit_pageurl as a wrapper around cgit_fileurl

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 13:13:40 +0200
86ca0223
add plain uncompressed tar snapshort format

time to make available snapshots selectable

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 02:14:35 +0200
18a99bdf
introduced .tar.bz2 snapshots

 - reworked write_tar_gzip_archive to handle arbitrary filter as a
   write_compressed_tar_archive
 - reformatted whitespaces in the said function to adhere to common cgit
   standards
 - added wrappers around write_compressed_tar_archive for .tar.gz and .tar.bz2
 - added a hint for vim to use 8 characters shift width by default

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Sat, 21 Jul 2007 02:05:34 +0200
4a92cbb7
compress .tar.gz using gzip as a filter
Michael Krelin hacker@klever.net
Fri, 20 Jul 2007 20:58:23 +0200
127f43d4
added a chk_non_negative check
Michael Krelin hacker@klever.net
Fri, 20 Jul 2007 20:56:43 +0200
3aae8270
css: adjust vertical-align of commit info th cells
Michael Krelin hacker@klever.net
Wed, 18 Jul 2007 14:55:40 +0200
f97c707a
add support for snapshot tarballs
- reworked cgit_print_snapshot to use a list of supported archivers and pick
	one for the suffix supplied
- moved printing of snaphot links into ui-snapshot and make it iterate through
	the said list
Michael Krelin hacker@klever.net
Wed, 18 Jul 2007 14:40:03 +0200
e651cb0d
Rename dirlink to gitlink.

Git changed from dirlink to gitlink in
302b9282c9ddfcc704ca759bdc98c1d5f75eba2f.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
Jeffrey C. Ollie jeff@ocjtech.us
Mon, 04 Jun 2007 12:28:56 -0500
2e3b6fc4
Use git-1.5.3.3
Lars Hjemli hjemli@gmail.com
Mon, 01 Oct 2007 12:50:07 +0200
fd39489f
correct typo in CSS
Michael Krelin hacker@klever.net
Fri, 05 Oct 2007 00:21:30 +0200
13d2b0b2
Skip unknown header fields when parsing tags and commits

Both the commit- and tagparser failed to handle unexpected header fields.
This adds futureproofing by simply skipping any header we don't know/care
about.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 24 Oct 2007 21:14:44 +0200
ac1f493b
Add links to the new refs page from summary page

If either branches or tags are filtered on the summary page, add a link to
refs/heads and/or refs/tags right below the last branch/tag.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:47:44 +0200
7937d060
Add support for refs view

This enables the new urls $repo/refs, $repo/refs/heads and $repo/refs/tags,
which can be used to print _all_ branches and/or tags.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:36:53 +0200
8efb05f9
Make cgit_print_branches()/cgit_print_tags() external

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:25:40 +0200
6bce91be
Add descriptions of summary-branches and summary-tags to cgitrc

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:15:54 +0200
763a6a09
Add support for config param summary-branches

This parameter can be used to specify max number of branches to show
on the summary page (if not all branches will be displayed, the "most
idle" branches are the ones to be pruned). The default value for this
parameter is 0, which disables the pruning.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:13:42 +0200
f6310fec
Move logic for age comparision from cmp_tag_age into cmp_age()

Simple refactoring to enable later filtering of branches based on age.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 10:06:03 +0200
fe211c7e
Add support for config param summary-tags

This parameter can be used to specify max number of tags to show on
the summary page. If not specified, all tags are printed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 25 Oct 2007 10:40:16 +0200
ef1cc6ef
Sort tags by age

This adds a function to compare timestamps and then uses it as callback
for qsort() before printing out tags.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 25 Oct 2007 20:33:04 +0200
502d7107
Use reflist to print tag info

This updates ui-summary.c to use a reflist instead of for_each_tag_ref(),
as a step towards more flexible tag handling (filtering/sorting).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 25 Oct 2007 10:28:15 +0200
0c1ebce2
Use reflist to print branch info

This updates ui-summary.c to use a reflist instead of for_each_branch_ref(),
as a step towards more flexible branch handling (filtering/sorting).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 25 Oct 2007 10:13:25 +0200
e397ff70
Add functions and types for ref lists

This adds two structs, refinfo and reflist, and functions for building
a list of refs.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 25 Oct 2007 09:30:06 +0200
c61360fe
cgit_parse_commit(): Add missing call to xstrdup()

It's rather silly to point into random memory-locations. Also, remove a
call to strdup() used on a literal char *.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Oct 2007 13:50:18 +0200
a2ebbd69
Use utf8::reencode_string from git

This replaces the iconv-support in cgit with similar functions already
existing in git.

Signed-off-by: Lars Hjemli <hjemli@gmai.com>
Lars Hjemli hjemli@gmail.com
Mon, 05 Nov 2007 22:27:43 +0100
7858a309
Convert subject and message with iconv_msg.
Jonathan Bastien-Filiatrault joe@x2a.org
Fri, 26 Oct 2007 18:13:41 -0400
af081983
Add iconv_msg function.
Jonathan Bastien-Filiatrault joe@x2a.org
Fri, 26 Oct 2007 18:11:26 -0400
aa5cc328
Set msg_encoding according to the header.
Jonathan Bastien-Filiatrault joe@x2a.org
Fri, 26 Oct 2007 18:10:26 -0400
3845e177
Add commit->msg_encoding, allocate msg dynamicly.
Jonathan Bastien-Filiatrault joe@x2a.org
Fri, 26 Oct 2007 18:09:06 -0400
c188c482
Support "/" as virtual-root

When the virtual-root was a single "/", it would be normalized to NULL due
to removal of trailing slashes, which in turn would fool us to belive that
we shouldn't generate virtual urls.

This makes the "/" normalize to "", effectively allowing virtual urls like
http://example.com/projectname to be generated without specifying the
full domain name as the virtual root.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 08 Nov 2007 12:20:05 +0100
2919b91d
CGIT 0.7.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 09 Nov 2007 13:51:00 +0100
9b18632b
Makefile install: include cgit.png, do not empty cache

The cache-cleaning is potentially dangerous, so lets move it away from the
install target. A special emptycache target can be used to run the rm -rf.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 09 Nov 2007 13:47:58 +0100
2ff33a8a
Set commit date on snapshot contents

The testsuite revealed that cgit snapshots don't set any useful timestamp on
the files contained in the snapshot.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 13:14:15 +0100
2915483e
Fix html error detected by test-suite

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 13:04:28 +0100
b4649fc9
Create initial testsuite

This creates a simple testsuite, heavily inspired by the testsuite in git.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 00:40:58 +0100
fc4c4ba3
Handle missing timestamp in commit/tag objects

When a commit or tag lacks author/committer/tagger timestamp, do not skip
the next line in the commit/tag object.

Also, do not bother to print timestamps with value 0 as it is close to certain
to be bogus.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 02 Dec 2007 22:11:35 +0100
5b75064a
Set commit date on snapshot contents

The testsuite revealed that cgit snapshots don't set any useful timestamp on
the files contained in the snapshot.

Cherry-picked-from: 2ff33a8a0405b420cd75e0e207c7efeecd6f130b
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Nov 2007 13:14:15 +0100
b74cc915
CGIT 0.7.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 10 Jan 2008 13:50:22 +0100
edf0ae3b
Use GIT-1.5.3.8
Lars Hjemli hjemli@gmail.com
Thu, 10 Jan 2008 13:47:18 +0100
2216fd64
Compare string lengths when parsing the snapshot mask

We used to rely on the result from strncmp() without comparing the length of
the strings involved. Even worse, any single-character format specifier would
enable zip-format due to the optional '.'-prefix since the length of the
mask then would become zero.

Noticed-by: Evan Martin <sys@neugierig.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 03 Dec 2007 00:39:20 +0100
7b346647
Default repo description to "[no description]"

Otherwise, when you leave out a description for a repository, the NULL
default causes cgit to print out titles like "cgit - (null)".

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Evan Martin martine@xen.localdomain
Sun, 02 Dec 2007 14:39:30 -0800
eacde43d
Fix segfault

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Hiroki Hattori seagull.kamome@gmail.com
Sun, 24 Feb 2008 02:57:34 +0900
c6f74764
Reset ctx.repo to NULL when the config parser is finished

This global variable is used by the config parsing callback to keep track
of the currently configured repository. If it is not reset to NULL when
the config parser is finished, and neither `url` or `r` is specified on the
querystring, cgit will wrongly consider the last configured repo as
selected.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 08 Apr 2008 21:27:12 +0200
e87e8963
Move cgit_parse_query() from parsing.c to html.c as http_parse_querystring()

This is a generic http-function.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 08 Apr 2008 21:11:36 +0200
20a33548
Move function for configfile parsing into configfile.[ch]

This is a generic function which wanted its own little object file.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 28 Mar 2008 00:09:11 +0100
ee4056bd
Add cache.h

The functions found in cache.c are only used by cgit.c, so there's no
point in rebuilding all object files when the cache interface is changed.


Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 27 Mar 2008 09:22:13 +0100
dc3282f0
Remove global and obsolete cgit_cmd

This variable was obsoleted by cmd.c.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 25 Mar 2008 02:00:09 +0100
c60781d6
Makefile: copy the QUIET constructs from the Makefile in git.git

These constructs were introduced by Shawn O. Pearce in commit
74f2b2a8d006a49e1be7e30731c2f7365d2741d1.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 25 Mar 2008 01:41:10 +0100
92908af4
Move cgit_version from shared.c to cgit.c

With the matching Makefile change, this makes sure that only cgit.o and cgit
proper needs to be rebuildt when VERSION has been modified.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 23:10:59 +0100
df90b51b
Makefile: autobuild dependency rules

This uses gcc to generate dependency rules for each `.o` file, based on the
corresponding `.c` file, into a new set of `.d` files (which are also defined
to depend on the same set of source files as their `.o` files).

Result:
* all objectfile dependencies are correctly calculated
* only the necessary dependencies are recalculated when a sourcefile is updated

Inspiration for the build rules:
* http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites
* http://make.paulandlesley.org/autodep.html

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 23:01:44 +0100
27181869
Initial Makefile cleanup

Sort the list of object files to improve readability/mergeability and remove
manual dependency information which will soon be generated automatically.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 20:49:41 +0100
163037e7
Move non-generic functions from shared.c to cgit.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 17:26:08 +0100
a4d1ca1d
Add ui-shared.h

This is finally a proper headerfile for the shared ui-functions which
used to reside in cgit.h

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 16:50:57 +0100
c5984a98
Add separate header-files for each page/view

Yet another step towards removing cgit.h.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 16:38:47 +0100
f34478cb
Refactor snapshot support

The snapshot support needs to be split between output- and config-related
functions to get the layering between shared.c and ui-*.c right. There
is also some codestyle-issues which needs fixing to make the snapshot
functions more similar to the rest of the cgit code.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 16:00:27 +0100
e0e4478e
Add command dispatcher

This simplifies the code in cgit.c and makes it easier to extend cgit with
new pages/commands.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 01:09:39 +0100
b608e88a
Remove obsolete cacheitem parameter to ui-functions

This parameter hasn't been used for a very long time...

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 01:00:36 +0100
f3c1a187
Add struct cgit_page to cgit_context

This struct is used when generating http headers, and as such is another
small step towards the goal of the whole cleanup series; to invoke each
page/view function with a function pointer.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Mar 2008 00:51:19 +0100
b1f9b9c1
Introduce html.h

All html-functions can be quite easily separated from the rest of cgit, so
lets do it; the only issue was html_filemode which uses some git-defined
macros so the function is moved into ui-shared.c::cgit_print_filemode().

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 23 Feb 2008 22:45:33 +0100
b88fb016
Improve initialization of git directory

Using the functions offered by libgit feels like the right thing to do. Also,
make sure that config errors gets properly reported.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Feb 2008 21:16:53 +0100
d1f3bbe9
Move cgit_repo into cgit_context

This removes the global variable which is used to keep track of the
currently selected repository, and adds a new variable in the cgit_context
structure.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Feb 2008 13:56:09 +0100
b228d4ff
Add all config variables into struct cgit_context

This removes another big set of global variables, and introduces the
cgit_prepare_context() function which populates a context-variable with
compile-time default values.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Feb 2008 13:07:13 +0100
d14d77fe
Introduce struct cgit_context

This struct will hold all the cgit runtime information currently found in
a multitude of global variables.

The first cleanup removes all querystring-related variables.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 16 Feb 2008 11:53:40 +0100
28d781f3
Make repository search case insensitive

This reuses the strcasestr() compiled or linked by libgit.a to implement a
case insensitive variation of the repository search.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 Apr 2008 12:42:27 +0200
39912a24
Remove 'patch' link from tab, add to commit view

It's a bit confusing to enter the patch view from the tab, since it has no
layout. And the commit view has always lacked showing the commit id. Both of
these warts are fixed by this commit, which adds a new header line in the
commit view which shows the commit id as a 'permalink' to the current commit
and also adds a link to the patch view of the current commit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 Apr 2008 12:20:00 +0200
536b0541
Implement minimal freetext search in the repolist

This makes the repolist much more usable when there's a lot of repositories
registered in cgitrc.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 Apr 2008 11:57:10 +0200
931fc6d1
More layout fixes

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 Apr 2008 10:57:11 +0200
72a69b77
Minor fixup in tree-view css

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 Apr 2008 20:18:16 +0200
68cb8483
Reintroduce the branch switcher

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 Apr 2008 20:11:49 +0200
7c0d2d9f
Add fixed link to index page from repo header

This makes it easier to get back to the index page, and also re-enables
the usage of logo-link in cgitrc.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 Apr 2008 19:59:41 +0200
89aa3c0d
Include diff in commit view

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 Apr 2008 15:53:53 +0200
f135569b
Replace sidebar/logo

This replaces the sidebar with a more 'common' header layout and also
updates the logo.

Not quite finished yet, though.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 Apr 2008 15:53:31 +0200
71adba1f
Add 'about site' and 'about repo' pages

This commit uses the options and changes from the last few commits to
implement a new 'about' command which works both with and without a
repo.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 29 Apr 2008 01:09:41 +0200
c6431a71
Prepare for 'about site' page / add 'root-readme' option to cgitrc

The new option names a file which will be included on a new page, next
to the current 'index' page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 29 Apr 2008 01:06:30 +0200
651ef797
Make it possible for a single cmd to work both with and without a repo

When cgit_cmd.want_repo was 0, we used to assume that the cmd would never
be invoked for a repo. But soon this will become untrue (the 'about' cmd
is rapidly approching), so from now on we will initialize any requested
repo even if want_repo==0 (and return an error if want_repo==1 but no repo
is specified).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 29 Apr 2008 01:01:30 +0200
4c991604
Re-enable 'index-info' and add support for 'root-desc' in cgitrc

The 'index-info' option got lost when the layout was converted from
sidebar to old-fashioned header (noticed by Harley Laue, thanks!), and
this commit re-enables it.

But there is now also an alternative in the 'root-desc' option; where
'index-info' specifies a file to include, 'root-desc' specifies the text
literally. This might be nicer for the one-liner descriptions which these
options typically provides.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 29 Apr 2008 00:55:34 +0200
80628178
Move included header-file out of repolist table

When the 'index-header' option is specified in cgitrc we used to print
the included file content inside the repolist table, which is bad style.

This commit makes the included file be printed before the table.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 29 Apr 2008 00:35:49 +0200
90f64ad9
Prepare for 'about repo' page

Each repo can include an external file which used to be included on the
top of the summary page, but it will now soon get a page of it own.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 28 Apr 2008 23:06:57 +0200
9000bbf8
Add page 'ls_cache'

This new page will list all entries found in the current cache, which is
useful when reviewing the new cache implementation. There are no links to
the new page, but it's reachable by adding 'p=ls_cache' to any cgit url.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 28 Apr 2008 12:10:13 +0200
939d32fd
Redesign the caching layer

The original caching layer in cgit has no upper bound on the number of
concurrent cache entries, so when cgit is traversed by a spider (like the
googlebot), the cache might end up filling your disk. Also, if any error
occurs in the cache layer, no content is returned to the client.

This patch redesigns the caching layer to avoid these flaws by
* giving the cache a bound number of slots
* disabling the cache for the current request when errors occur

The cache size limit is implemented by hashing the querystring (the cache
lookup key) and generating a cache filename based on this hash modulo the
cache size. In order to detect hash collisions, the full lookup key (i.e.
the querystring) is stored in the cache file (separated from its associated
content by ascii 0).

The cache filename is the reversed 8-digit hexadecimal representation of

  hash(key) % cache_size

which should make the filesystem lookup pretty fast (if directory content
is indexed/sorted); reversing the representation avoids the problem where
all keys have equal prefix.

There is a new config option, cache-size, which sets the upper bound for
the cache. Default value for this option is 0, which has the same effect
as setting nocache=1 (hence nocache is now deprecated).

Included in this patch is also a new testfile which verifies that the
new option works as intended.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 28 Apr 2008 11:32:42 +0200
42effc93
allow specification of directly linked blobs mimetypes

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Tue, 24 Jun 2008 23:42:32 +0200
01d2dce7
allow blob extract blobs by head/path combination

 If blob is invoked with no id=, it tries to look up h= and search for path= in
 there. Once found, proceed as normal, otherwise, fail as normal.

Signed-off-by: Michael Krelin <hacker@klever.net>
Michael Krelin hacker@klever.net
Tue, 24 Jun 2008 23:33:24 +0200
b2a3d31e
Add atom-support

This enables a page which generates atom feeds for the current branch and
path, heavily inspired by the atom-support in gitweb.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 21 May 2008 08:17:54 +0200
02a545e6
Add support for cloning over http

This patch implements basic support for cloning over http, based on the
work on git-http-backend by Shawn O. Pearce.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 01:20:24 +0200
885096c1
Supply status description to html_status()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 22:57:44 +0200
65b7b876
ui-tree: link to plain view instead of blob view

The urls for plain view makes it possible to download blobs without knowing
their SHA1, but the function needs to be promoted and the link from tree
view seems like a perfect fit.

PS: Although hidden, the blob view still is nice for direct blob access so
there's no point in removing it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 11:07:13 +0200
e5da4bca
Implement plain view

This implements a way to access plain blobs by path (similar to the
tree view) instead of by sha1.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 06 Aug 2008 10:53:50 +0200
9c931b1e
use Host: header to generate cgit_hosturl

I run an instance of lighttpd for cgit behind nginx (nginx
doesn't execute CGI).  So the port (SERVER_PORT=33333) that
lighttpd runs on sends to cgit is different from the standard
port 80 that public clients connect to (via nginx).

This was causing the Atom feed URL to show the private port
number that lighttpd was running on.

Since the HTTP/1.1 "Host" header includes the port number if
running on a non-standard port, it allows non-client-facing HTTP
servers to transparently generate public URLs that clients can
see.

So use the "Host" header if it is available and fall back to
SERVER_NAME/SERVER_PORT for some clients that don't set
HTTP_HOST.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong normalperson@yhbt.net
Sun, 31 Aug 2008 23:30:33 -0700
a608ff7b
ui-tag: show the taggers email

If it's specified there's no point in hiding it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 15 Sep 2008 22:40:02 +0200
a8305a95
parsing.c: be prepared for unexpected content in commit/tag objects

When parsing commits and tags cgit made too many assumptions about the
formatting of said objects. This patch tries to make the code be more
prepared to handle 'malformed' objects.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 14 Sep 2008 09:45:37 +0200
b575115d
ui-shared.c: use html_url_arg()

The link-generating functions are updated to use the new html_url_arg
function, thereby fixing links to strange repos, branches and files.

Also, the test-suite is updated to verify some cases of strange urls.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 12:52:25 +0200
a36a0d9d
html.c: add html_url_arg

This function can be used to properly escape querystring parameter values.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 12:49:46 +0200
49ecbbdd
ui-repolist + ui-shared: Use cgit_summary_link()

This makes is possible to use cgit with repository urls containing special
url characters like '#' and '?'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 17:16:36 +0200
e9d3bd54
ui-shared.c: add cgit_summary_link()

This function can be used to generate a link to the summary page for the
currently active repo.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 16:55:50 +0200
44b208aa
ui-shared.c: use html_url_path() in repolink()

This makes sure that reponames and paths are properly escaped when used
as urls.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 16:54:44 +0200
22a597e5
html.c: add html_url_path

This function can be used to generate properly escaped path-components
for links.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 05 Oct 2008 16:52:57 +0200
efaccb3d
Makefile: enable compilation on uclibc

Original-patch-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 11 Oct 2008 20:21:06 +0200
e4d2f2b0
Fix tests to work on Ubuntu (dash)

The system shell (/bin/sh) on Ubuntu is dash, which aims to be a
POSIX standard shell.  In particular, dash does not implement any
of the common extensions to the standard that, say, bash and ksh
do.

Replace some non-POSIX constructs in setup.sh with more portable
and mundane code.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ramsay Jones ramsay@ramsay1.demon.co.uk
Tue, 04 Nov 2008 19:23:41 +0000
bdd4a56a
Fix some warnings to allow -Werror

The type used to declare the st_size field of a 'struct stat' can
be a 32- or 64-bit sized type, which can vary from one platform to
another, or even from one compilation to another.  In particular,
on linux, if you include the following define:

    #define _FILE_OFFSET_BITS 64

prior to including certain system header files, then the type used
for the st_size field will be __off64_t, otherwise it will be an
__off_t.  Note that the above define is included at the top of
git-compat-util.h.

In cache.c, the "%zd" format specifier expects a "signed size_t",
another type which can vary, when an __off64_t or a __off_t is
provided.  To supress the warning, use the PRIuMAX format specifier
and cast the st_size field to uintmax_t.  This should work an any
platform for which git currently compiles.

In ui-plain.c, the size parameter of sha1_object_info() and
read_sha1_file() is defined to be "unsigned long *" not "size_t *".
So, to supress the warning, simply declare size with the correct type.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ramsay Jones ramsay@ramsay1.demon.co.uk
Tue, 04 Nov 2008 19:22:08 +0000
a918c068
Use GIT-1.6.0.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 06 Nov 2008 19:13:21 +0100
5b272483
Use mode 0644 for non-executable files

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Karl Chen quarl@cs.berkeley.edu
Wed, 05 Nov 2008 02:45:18 -0800
c7d1402b
ui-repolist: handle empty agefiles

When the agefile was empty the old code would happily reuse the static
buffer filled by a previous call to read_agefile().

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 14 Nov 2008 09:29:22 +0100
d2592a2c
Merge branch 'rj/buildtweaks' into stable
Lars Hjemli hjemli@gmail.com
Fri, 05 Dec 2008 19:13:32 +0100
a1b01b25
ui-log: try to disambiguate ref names

The 'h' querystring parameter in cgit is normally used to specify
a branch (i.e. a ref below refs/heads/), but if a repository contains
a tag with the same name as a branch the output from ui-log would use
the tag as start-revision.

This patch tries to fix the issue by checking if the specified ref is
valid as a branch name; if so, the full refname is used in the call
to setup_revisions().

Noticed-by: Takamori Yamaguchi <akschar@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 03 Dec 2008 17:34:23 +0100
14b4e108
parsing.c: enable builds with NO_ICONV defined

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 05 Dec 2008 19:10:28 +0100
7115f7d2
ui-repolist: avoid build warning for strcasestr(3)

The non-standard function strcasestr is only defined if _GNU_SOURCE has
also been defined.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 05 Dec 2008 19:04:17 +0100
a5e899e4
Makefile: allow cgit.conf to override platform-specific tweaks

If the makefile doesn't automatically define the correct build variables
it is nice to be able to define them explicitly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 05 Dec 2008 18:47:16 +0100
97fdac16
Extra cygwin-specific changes

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ramsay Jones ramsay@ramsay1.demon.co.uk
Sat, 15 Nov 2008 18:26:32 +0000
c57aceb1
ui-shared: shorten the sha1 printed by cgit_object_link

Such links was printed as the object type followed by the objects complete
sha1. We still use the complete sha1 in the link but we no longer show it
in all its glory; only the first 10 hex chars are printed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Dec 2008 21:58:59 +0100
65962685
ui-refs.c: show download links for all tags referring to commit objects

The snapshot function has only been linked to from the commit page while
users often would want to download a certain release. With this patch,
direct download links will now be printed for each tagged release on the
repo summary page.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Dec 2008 21:56:07 +0100
b9053a4f
ui-shared: exploit snapshot dwimmery in cgit_print_snapshot_links

Since we know that ui-snapshot.c is able to extract the revision from the
filename, there's no longer necessary to specify the revision with a 'id'
querystring argument.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Dec 2008 21:50:19 +0100
4b4f8d12
ui-snapshot: improve extraction of revision from snapshot name

The modified get_ref_from_filename() supports the following snapshot
formats:
* $REV.$EXT
* $REPO[-_]*v?$REV.$EXT

This implies that the following urls will retrieve the expected revision:
* http://hjemli.net/git/cgit/snapshot/v0.8.1.tar.gz
* http://hjemli.net/git/cgit/snapshot/0.8.1.tar.gz
* http://hjemli.net/git/cgit/snapshot/cgit-0.8.1.tar.gz
* http://hjemli.net/git/cgit/snapshot/cgit-140012d7a8.tar.gz

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 01 Dec 2008 19:13:44 +0100
314d9ea5
Set prefix in snapshots when using dwimmery

This patch sets the directory prefix in archives to be the filename,
excluding the suffix (.tar.gz, .tar.bz2 etc).

The patch also removes the prefix parameter in cgit_print_snapshot()
as the prefix might differ.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Natanael Copa natanael.copa@gmail.com
Sat, 29 Nov 2008 21:49:07 -0800
88131703
ui-repolist: implement lazy caching of repo->mtime

When sorting the list of repositories by their last modification time,
cgit would (in the worst case) invoke fstat(3) four times and open(3)
twice for each callback from qsort(3). This obviously scales very badly.

Now, the calculated modtime for each repo is saved in repo->mtime, thus
keeping the number of stat/open invocations identical for sorted and
unsorted repo-listings.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 16:46:37 +0100
54272e60
ui-repolist: sort null values last

When sorting on e.g. owner, it's not interesting to get all repos
without owner at the top of the list.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 14:27:35 +0100
f250c1ca
ui-repolist: add support for sorting any column

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 14:08:51 +0100
cbac02c8
ui-repolist: extract get_repo_modtime() from print_modtime()

The new function is then used by both print_modtime() and
cgit_reposort_modtime().

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 13:33:02 +0100
d71c0c72
Add support for sorting by Age in the repolist

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Benjamin Close Benjamin.Close@clearchain.com
Tue, 25 Nov 2008 06:25:35 -0800
ab67164d
ui-log: use css to make full-log prettier

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 19:11:26 +0100
951f550b
ui-log: (ab)use extra columns for commit message when showmsg=1

If the commit message has extra long lines it's better to use the author/
files/lines columns to show those lines than to push the columns of screen
and force the users to hscroll.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 18:58:31 +0100
0274b57d
ui-log: add support for showing the full commit message

Some users prefer to see the full message, so to make these users happy
the new querystring parameter "showmsg" can be used to print the full
commit message per log entry.

A link is provided in the log heading to make this function accessible,
and all links and forms tries to preserve the users preference.

Note: the new link is not displayed on the summary page since the point
of the summary page is to be a summary, but it is still obeyed if specified
manually.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 29 Nov 2008 18:39:41 +0100
b6faa780
tests/setup.sh: allow testsuite to fail properly with POSIX standard shells

The "((expr))" construct is not implemented by e.g. dash, so this commit
replaces the construct with a more portable one.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 12:03:54 +0100
2755af6e
tests/t0010-validate-html.sh: skip tests if 'tidy' is not available

Noticed-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 11:53:59 +0100
03afc5fe
ui-patch: whitespace changes in the patch generation code

Add a space between the committer name and email, and remove
superfluous spaces in the date header.

This makes cgit-generated patches match the output from git-format-patch
almost exactly, at least as far as the email headers go.

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Tomas Carnecky tom@dbservice.com
Tue, 30 Dec 2008 11:14:52 +0100
f3c99cf1
ui-tree.c: do not add blank line when displaying blobs

Also, fix a related bug in the test-suite.

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 06 Jan 2009 21:37:23 +0100
c63aaff2
Makefile: avoid libcurl when building git

We don't need support for fetching/pushing in libgit.a, hence we don't need
to link with libcurl.

Noticed-by: Robin Redeker <elmex@ta-sa.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 10 Jan 2009 15:18:18 +0100
377a1c8c
Untie logic for SCRIPT_NAME and PATH_INFO

SCRIPT_NAME is used as fallback for virtual-root when virtual-root is
unspecified in cgitrc and PATH_INFO is used as fallback for the query-
string parameter 'url' when the latter is unspecified. But until now,
the use of PATH_INFO depended on virtual-root also being unspecified,
i.e. it was impossible to use PATH_INFO when virtual-root was specified.

This commit makes the fallback on SCRIPT_NAME and PATH_INFO independent
code paths, i.e. it is now possible to specify virtual-root in cgitrc
while still using PATH_INFO (instead of rewrite rules) to get 'pretty
urls'.

Noticed-by: Jack Moffitt <jack@chesspark.com>
Noticed-by: LiKai Liu <liulk@cs.bu.edu>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 26 Dec 2008 10:33:01 +0100
ed77b2e0
ui-snapshot.c: change mime-type for tar.gz and tar.bz2

The updated mime-types seems to work better than the old ones with both
safari and firefox.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 26 Dec 2008 11:33:59 +0100
7bbc2745
tests/t0107-snapshot.sh: make testscript match updated snapshot behavior

Since cgit now returns a 404 error when the snapshot filename cannot be
resolved to a commit object, the testscript needs to request a valid
snapshot name.

Also, the script assumed that the toplevel directory in the snapshot
would get the name of the repository but it's now named similar to
the requested snapshot.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Dec 2008 10:52:35 +0100
c4b45de3
return 404 if snapshot is not found

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Natanael Copa natanael.copa@gmail.com
Tue, 02 Dec 2008 11:31:34 +0100
720b6ece
ui-tag: escape tagnames properly

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 16:37:47 +0100
eb14609d
Avoid SEGFAULT on invalid requests

When an unknown page is requested, either on the querystring or via
PATH_INFO, we end up with a null-referencing cgit_cmd. This null-
pointer is then used as argument to the hc() function (which decides
what tab to render as 'active'), but this function failed to check if a
valid cmd was specified and a SEGFAULT would occur. This patch fixes the
issue by introducing a 'fallback-cmd' which specifies what tab to render
as 'active' when no valid cmd is requested.

While at it, we now also keep track of the active repository even if an
invalid cmd was requested since we want to show the error message about
the invalid request in the correct context.

Noticed-by: Robin Redeker <elmex@ta-sa.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 11 Jan 2009 21:23:04 +0100
d529c6fb
Makefile: install cgit.{css,png} in CGIT_DATA_PATH

CGIT_DATA_PATH defaults to CGIT_SCRIPT_PATH, but allows users to
install the cgi and the data files in different locations.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Sun, 11 Jan 2009 18:23:59 -0500
4ac89ec8
Makefile: add INSTALL var to set install command

This also explicitly sets the modes for installed files (755 for the
.cgi, 644 for the .css and .png).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Sun, 11 Jan 2009 18:23:52 -0500
3796c2d8
Fix tar.bz2 snapshot example

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Sun, 11 Jan 2009 18:23:39 -0500
b54ef974
ui-stats.c: reuse cgit_add_hidden_formfields()

This makes sure that the currect branch and path is preserved when
changing the stats period or author count.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Dec 2008 15:57:55 +0100
c3c925f4
ui-shared: externalize add_hidden_formfields()

This function will be reused by ui-stats.c in the next commit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Dec 2008 15:52:35 +0100
837d464a
ui-tree: add link to stats page per path

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Dec 2008 13:34:42 +0100
eaf2d25c
ui-shared: add and use cgit_stats_link()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Dec 2008 13:34:16 +0100
fb2f3f6c
ui-stats: replace 'enable-stats' setting with 'max-stats'

The new 'max-stats' and 'repo.max-stats' settings makes it possible to
define the maximum statistics period, both globally and per repo. Hence,
it is now feasible to allow statistics on repositories with a high commit
frequency, like linux-2.6, by setting repo.max-stats to e.g. 'month'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Dec 2008 13:17:21 +0100
c6a6aa21
ui-stats: enable path-filtered stats

When a path is specified on the querystring the commit statistics will
now be filtered by this path.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 07 Dec 2008 11:45:28 +0100
f86a23ff
Add a 'stats' page to each repo

This new page, which is disabled by default, can be used to print some
statistics about the number of commits per period in the repository,
where period can be either weeks, months, quarters or years.

The function can be activated globally by setting 'enable-stats=1' in
cgitrc and disabled for individual repos by setting 'repo.enable-stats=0'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 06 Dec 2008 17:38:19 +0100
a90e2aa4
changed objects are outputted, allowing for selections of code only
Onne Gorter onne.gorter@avinity.net
Wed, 07 Jan 2009 13:56:14 +0100
38fde35f
tests/t0105-commit.sh: expect commit decorations

When a commit is referenced by a branch or tag the commit subject-
line will be suffixed with the proper decorations, hence the test
for this line needs to be updated.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 22:59:23 +0100
236665d7
cgit.css: minor adjustment of commit decorations

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 22:42:03 +0100
0027e38b
Add decorations to commit pages

This adds the tag and branch head decorations to the commit pages.  This is
similar to how commits are displayed in the standard gitweb interface.

Signed-off-by: Justin Waters <justin.waters@timesys.com>
Justin Waters justin.waters@timesys.com
Mon, 12 Jan 2009 10:23:28 -0500
ba75f661
CGIT 0.8.1.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 27 Jan 2009 20:35:49 +0100
7efcef00
html.c: use correct escaping in html attributes

First, an apostrophe is not a quote. Second, we also need to escape
quotes. And finally, quotes are encoded as '&quot;', not '&quote;'.

Sighned-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 29 Jan 2009 22:21:15 +0100
b115955d
Add support for a custom header

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 29 Jan 2009 21:27:39 +0100
481ce5e2
shared.c: avoid SEGFAULT when checking for binary buffers

Before calling buffer_is_binary() we need to verify that the buffer
is valid.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 01 Feb 2009 19:29:24 +0100
ae1d4d75
ui-tree: show hexdump of binary blobs

This teaches ui-tree to detect binary blobs and display them similar
to `hexdump -C` (only wider).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 31 Jan 2009 17:45:48 +0100
c495cf02
Handle binary files in diffs

This teaches all diff-related operations (i.e. ui-log, ui-diff and ui-patch)
how to handle binary files.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 31 Jan 2009 10:40:40 +0100
5e57cb24
Makefile: add doc-related targets

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 12 Feb 2009 10:53:31 +0100
6d2067ae
Add cgit-doc.css

This css is used to tweak the display of asciidoc-generated html for
cgitrc.5.txt.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 12 Feb 2009 10:24:25 +0100
c54f8a5d
cgitrc.5.txt: un-indent the name section

Otherwise, this section is treated as a preformatted, literal block.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 12 Feb 2009 10:12:05 +0100
b875a9ee
cgitrc.5.txt: wrap the example file in an asciidoc LiteralBlock

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 12 Feb 2009 10:02:09 +0100
d3b2933c
cgitrc.5.txt: make the cgitrc options a valid asciidoc labeled list

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 12 Feb 2009 09:58:28 +0100
9f9ede3d
make cgitrc.5.txt asciidoc manpage compatible

According to the instructions and requirements here:
http://www.methods.co.nz/asciidoc/chunked/ar01s20.html
Matt McCormick (thewtex) matt@mmmccormick.com
Wed, 11 Feb 2009 23:06:05 -0600
6fddad72
ui-snapshot: avoid segfault when no filename is specified

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 15 Mar 2009 08:57:33 +0100
11297361
fix segfault when displaying empty blobs

When size is zero, subtracting one from it turns it into
ULONG_MAX which causes an out-of-bounds access on buf.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Eric Wong normalperson@yhbt.net
Sat, 14 Mar 2009 18:41:47 -0700
fdd559ab
CGIT 0.8.2.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 15 Mar 2009 09:31:05 +0100
694dd438
use cgit_httpscheme() for atom feed
Diego Ongaro ongardie@gmail.com
Wed, 10 Jun 2009 18:18:34 -0500
87a89aed
add cgit_httpscheme() -> http:// or https://
Diego Ongaro ongardie@gmail.com
Wed, 10 Jun 2009 18:09:55 -0500
596eb8fc
ui-blob: return 'application/octet-stream' for binary blobs

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 11:51:19 +0200
7d770080
ui-plain: Return 'application/octet-stream' for binary files.

Signed-off-by: Remko Tronçon <git@el-tramo.be>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Remko Tronçon git@el-tramo.be
Sat, 25 Jul 2009 11:45:18 +0200
3ff58ddd
Add support for HEAD requests

This is a quick 'n dirty hack which makes cgit honor HEAD requests.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 19 Feb 2009 23:24:15 +0100
488a214a
Add support for ETag in 'plain' view

When downloading a blob identified by its path, the client might want
to know if the blob has been modified since a previous download of the
same path. To this end, an ETag containing the blob SHA1 seems to be
ideal.

Todo: add support for HEAD requests...

Suggested-by: Owen Taylor <otaylor@redhat.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 19 Feb 2009 22:38:36 +0100
f618e8f7
cgitrc.5.txt: document 'head-include'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 12:03:54 +0200
b5a3a204
Add head-include configuration option.

This patch adds an option to the configuration file, "head-include",
which works just like "header" or "footer", except the content is put
into the HTML's <head> tag.
Mark Lodato lodatom@gmail.com
Sun, 15 Mar 2009 00:11:54 -0400
7a8b3b41
cgit.h: keep config flags sorted

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 12:25:06 +0200
86b753cb
cgitrc.5.txt: document 'embedded' and 'noheader'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 12:23:30 +0200
ef0c6aad
Add support for 'noheader' option

This option can be used to disable the standard cgit page header, which
might be useful in combination with the 'embedded' option.

Suggested-by: Mark Constable <markc@renta.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 25 Jul 2009 12:19:31 +0200
0cbb5084
Add support for an 'embedded' option in cgitrc

When activated, cgit will neither generate http headers nor any 'framing'
html elements (like <html> and <body>). Also, all page content is now
wrapped in a <div id='cgit'> element to make it easier to select the
correct cgit classes when embedded/themed.

Suggested-by: Matt Sealey <matt@genesi-usa.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 22 Jan 2009 23:33:56 +0100
c4d46c70
Add support for mime type registration and lookup

This patch makes it possible to register mappings from filename
extension to mime type in cgitrc and use this mapping when returning
blob content in `plain` view.

The reason for adding this mapping to cgitrc (as opposed to parsing
something like /etc/mime.types) is to allow quick lookup of a limited
number of filename extensions (/etc/mime-types on my machine currently
contains over 700 entries).

NB: A nice addition to this patch would be to parse /etc/mime.types
when `plain` view is requested for a file with an extension for which
there is no mapping registered in cgitrc.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 13 Feb 2009 20:43:30 +0100
97b3d252
cgit.c: allow repo.*-filter options to unset the current default

If e.g. repo.commit-filter is specified as an empty string, this
is now properly handled as disabling the global commit-filter setting
for the current repository.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:39:44 +0200
e976df27
Add support for repo.commit-filter and repo.source-filter

These options can be used to override the default commit- and source-
filter settings per repository.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:22:00 +0200
f35db1cd
ui-commit: add support for 'commit-filter' option

This new option specifies a filter which is executed on the commit
message, i.e. the commit message is written to the filters STDIN and
the filters STDOUT is included verbatim as the commit message.

This can be used to implement commit linking by creating a simple
shell script in e.g. /usr/bin/cgit-commit-filter.sh like this:

#/bin/sh
sed -re 's|\b([0-9a-fA-F]{6,40})\b|<a href="./?id=\1">\1</a>|g'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 31 Jul 2009 17:42:57 +0200
46b7abed
ui-tree: add support for source-filter option

This new option is used to specify an external command which will be
executed when displaying blob content in the tree view. Blob content
will be written to STDIN of the filter and STDOUT from the filter
will be included verbatim in the html output from cgit. The file name
of the blob will be passed as the only argument to the filter command.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 31 Jul 2009 16:55:27 +0200
18dfbdc0
ui-snapshot: use cgit_{open|close}_filter() to execute compressors

This simplifies the code in ui-snapshot.c and makes the test-suite
verify the new filter-functions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 31 Jul 2009 15:52:57 +0200
d6f60725
Add generic filter/plugin infrastructure

The functions cgit_open_filter() and cgit_close_filter() can be used to
execute filters on the output stream from cgit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 31 Jul 2009 17:38:38 +0200
537c05f1
Add 'about-filter' and 'repo.about-filter' options

These options can be used to execute a filter command on each about-page,
both top-level and for each repository (repo.about-filter can be used
to override the current about-filter).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:27:21 +0200
e1782fff
ui-summary: enable arbitrary paths below repo.readme

This change makes it possible to include any number of pages below
the 'about' tab for a repository. The path is assumed to be located
in the same directory as the 'repo.readme' file.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 11:50:34 +0200
80550bbe
ui-shared: add support for header/footer options when embedded=1

When embedded=1, cgit used to ignore the header and footer options.
But honoring these options when embedded=1 makes it possible to "frame"
the html fragment generated by cgit with any kind of static content,
i.e. it should become easier to integrate cgit with site-specfic
layouts.

Original-patch-by: Mark Constable <markc@renta.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 11 Aug 2009 10:12:35 +0200
8b2252b0
ui-shared: add support for NO_HTTP=1/--nohttp

cgit_print_http_headers() used to do nothing if 'embedded' was
specified in cgitrc, but that was wrong - we never want to skip the
headers when invoked as a CGI app. Sadly, there's no easy way to
detect if we're invoked as a CGI app or if we're invoked by another
CGI app, so for the latter case cgit needs to be invoked with either
--nohttp on the command line or NO_HTTP=1 in the environment.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 10 Aug 2009 09:20:17 +0200
60a26272
Cleanup handling of environment variables

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 10 Aug 2009 08:21:09 +0200
435a1da8
cgit.c: do not segfault on unexpected query-string format

The querystring_cb() function will be invoked with a NULL value when
the querystring contains a name not followed by a '='. Such a value
used to cause a segfault, which this patch fixes.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 17 Aug 2009 09:05:13 +0200
8a631b11
ui-tag.c: do not segfault when id is missing from query-string

The purpose of the tag page is to print info about a specific tag,
but if no tag was specified on the query-string cgit used to segfault.

With this patch, cgit will fallback to the value of the 'h' parameter
instead (which is never NULL due to prepare_repo_cmd() in cgit.c).

It will now also verify that the specified tagname is in fact a valid
ref in the 'refs/tags/' namespace, i.e. specifying 'id=master' will
trigger a 'Bad tag reference' error.

Noticed-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 17 Aug 2009 09:19:05 +0200
6421dc38
ui-shared: don't print header <img/> if there isn't a logo defined

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Matthew Metnetsky mimetnet@vidu.us
Mon, 29 Jun 2009 21:27:51 -0400
011f2e9b
truncate buffer before reading empty files

If readfile() reads an empty file, fgets() won't truncate the buffer
and it'll still contain the contents of the previously read file.

[lh: fixed similar issue in ui-repolist.c]

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Simon Arlott simon@fire.lp0.eu
Sat, 07 Mar 2009 00:06:24 +0000
b507252b
ui-plain.c: only return the blob with the specified path

When a path to a directory was specified for the 'plain'
view, each blob in the directory used to be returned to
the client. This patch fixes the issue by matching the
path of each blob against the requested path.

Noticed-by: Lars Stoltenow <penma@penma.de>
Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
Lars Hjemli larsh@slackbox.hjemli.net
Sun, 06 Sep 2009 19:33:10 +0200
6638f408
cgit.css: make the blob display in tree view a bit prettier

Adding some padding to the linenumbers while right-aligning them and
removing the background color makes the page more readable.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 21 Aug 2009 14:37:50 +0200
b0f946bc
Rename "linenumbers" to "enable-tree-linenumbers", change default to "1"

This makes the name of the cgitrc option more descriptive and at the
same time changes the default from "0" to "1" in an attempt to stay
backwards compatible - prior to the introduction of "source-filter"
and "linenumbers", cgit always generated linenumber links in the
tree view, but now this feature can be turned off (one might want to
do this if the source-filter performs line-wrapping etc).

While at it, the documentation is updated to match the surrounding
descriptions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Fri, 21 Aug 2009 14:26:52 +0200
d67cc7f9
Add 'linenumbers' config option

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Florian Pritz bluewind@xssn.at
Sun, 09 Aug 2009 20:42:45 +0000
03389d6e
ui-tree.c: show line numbers when highlighting

When source-filter is enabled, cgit currently will not display
linenumbers in the tree view. This patch restores the linenumber
function.

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Florian Pritz bluewind@xssn.at
Sun, 09 Aug 2009 13:43:18 +0000
ee554849
cgit.c: respect repo-local 'snapshots' option for --scan-path

The repo-specific 'snapshots' option is bitwise AND'ed with the global
'snapshots' option during parsing, and since the global cgitrc hasn't
been parsed when --scan-path is processed the global 'snapshots' will
always be 0 (i.e. no repo-specific 'snapshots' setting will have any
effect).

This patch fixes the issue by setting the global 'snapshots' mask to
0xFF (hence relying on later parsing of the generated cgitrc repolist
to do the right thing).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 13:31:49 +0200
588fb8ef
cgit.c: only print first line of repo.desc in print_repo()

Since repo.desc might have been populated by reading the 'description'
file in GIT_DIR, it may contain newlines. And by printing the literal
value, we may then generate an invalid cgitrc include-file.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 13:27:15 +0200
b47b7bd1
Add and use cgit_find_stats_periodname() in print_repo()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 11:02:48 +0200
5ca8df0a
cgit.c: generate repo.snapshots in print_repo()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 10:55:01 +0200
35483200
cgit.c: add missing options to print_repo()

Note: print_repo() still ignores repo.max-stats and repo.snapshots,
which both requires additional work since these settings are represented
internally as an enum and a bitmap.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 10:22:21 +0200
42e7a169
shared.c: initialize cgit_repo structs properly

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 10:14:02 +0200
2273c2c8
Add config option 'enable-filter-overrides'

This option must be enabled if repo-specific cgitrc files should be
allowed to override any of the 'filter' options.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 08:53:21 +0200
007df98d
cgitrc.5.txt: fix markup errors

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 07:51:48 +0200
e01229cf
ui-repolist: handle empty sections similar to NULL sections

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 07:42:03 +0200
74061ed5
Add support for repo-local cgitrc file

When recursively scanning a directory tree looking for git repositories,
cgit will now parse cgitrc files found within such repositories.

The repo-specific config files can include any repo-specific options
except 'repo.url' and 'repo.path'. Also, in such config files the 'repo.'
prefix can not be used, i.e. the valid options then becomes:
* name
* clone-url
* desc
* ower
* defbranch
* snapshots
* enable-log-filecount
* enable-log-linecount
* max-stats
* module-link
* section
* about-filter
* commit-filter
* source-filter
* readme

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 00:04:58 +0200
a1b3938f
cgit.c: refactor repo_config() from config_cb()

The new function repo_config() is used to handle all 'simple' repo
options, for the following reasons:
* code readability
* parser performance
* upcoming support for repo-local cgitrc files during scanning

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 23 Aug 2009 23:23:20 +0200
63816ec5
ui-repolist.c: sort by section name, repo name as default

When no sorting is requested by the client, cgit will now sort by
section name followed by repo name. This allows repos to be registered/
discovered independently of their display order.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 23 Aug 2009 23:09:31 +0200
39398545
Add config option 'repo.section'

This option can be used to specify the section name for the current
repository.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 23 Aug 2009 23:00:28 +0200
e7af002d
Introduce 'section' as canonical spelling for 'repo.group'

The 'repo.' prefix should be reserved for repo-specific options, but
the option 'repo.group' must still be honored to stay backwards
compatible.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 23 Aug 2009 22:58:39 +0200
50d5af3a
Add support for --scan-path command line option

This is an alias for --scan-tree (which might be deprecated in the
future).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 23 Aug 2009 19:36:45 +0200
00466376
Rename 'repo.scan' to 'scan-path'

The 'repo.' prefix will soon be reserved for repo-specific config
options.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 23 Aug 2009 19:35:56 +0200
b4dc93dc
cgitrc.5.txt: document repo.scan and cache-scanrc-ttl

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Aug 2009 17:42:14 +0200
d746827e
cgit.c: add support for caching autodetected repositories

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 20 Aug 2009 17:41:54 +0200
302a3efa
cgit.c: make print_repolist() and print_repo() reusable for caching

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 19 Aug 2009 17:47:24 +0200
523a2161
cache.h: export hash_str()

This function will be reused to cache the result of tree scanning.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 19 Aug 2009 17:43:47 +0200
6f3bf1ae
cgit.c: add support for cgitrc option 'repo.scan'

When specified, the specified path will be scanned for repositories.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 11 Aug 2009 10:09:06 +0200
fb9bf55c
scan-tree: detect non-bare repository and stop scanning early

We don't want to descend into every subdirectory of a git repository
with a workdir.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 11 Aug 2009 10:08:12 +0200
f92ca06e
CGIT 0.8.2.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 13 Sep 2009 22:14:12 +0200
8cfe4897
Close fd on error in readfile()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Rys Sommefeldt rys@pixeltards.com
Sat, 07 Nov 2009 15:24:45 +0100
e34a3b5a
Nov is the correct abbreviation
Danijel Tašov dt@korn.shell.la
Mon, 02 Nov 2009 22:10:04 +0100
21f67e7d
shared.c: return original errno

Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 07 Nov 2009 18:08:30 +0100
f2bf0a05
Don't crash when a repo-specific readme file is used

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Sami Kyöstilä sami.kyostila@gmail.com
Tue, 08 Dec 2009 18:18:10 +0100
ef07ccc7
"max-blob-size" config var to limit generated HTML size

Sometimes it is not feasible to generate the HTML pretty-print for large
files, especially if a source-filter is involved or binary data is to be
displayed. The "max-blob-size" config var allows to disable HTML output
for blobs bigger than X KBytes. Plain downloads are not affected.

Signed-off-by: Georg Lukas <georg@op-co.de>
Georg Lukas georg@op-co.de
Sat, 28 Nov 2009 03:44:33 +0100
545b5a5d
cgit.css: highlight directories in tree
Georg Lukas georg@op-co.de
Sat, 28 Nov 2009 03:07:34 +0100
56522ebe
syntax highlighting for all formats supported by "highlight"

The highlight tool can be given any of the supported file extensions
as its -S parameter. This patch replaces the case-switch by extracting
the extension from the supplied file name and passing it to highlight.
However, this requires a shell supporting the ${var##pattern} syntax,
like dash or bash.

Unknown extensions cause a fall-back to plain text using the --force
switch. Error messages are redirected to /dev/null.

A special case maps Makefile and Makefile.* to the "mk" extension.

The total overhead is reduced by calling "exec highlight". No forks are
needed during script execution.

Signed-off-by: Georg Lukas <georg@op-co.de>
Georg Lukas georg@op-co.de
Thu, 19 Nov 2009 12:14:45 +0100
735e15e3
In side-by-side diff, add support for marking individual characters.

Refuses to do so if the left hand side of the diff has different amount of
differing lines to the right hand side to avoid confusion.

Note that I use the naive dynamic programming approach for calculating the
longest common subsequence. We could probably be more efficient by using a
better algorithm. The LCS calculating function is O(n*m) and uses up n*m
amount of memory too (so if we we compare two strings of length 100, I use
an array of 10000 for calculating the LCS). Might want to not calculate LCS
if the length of the line is too large.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Ragnar Ouchterlony ragnar@lysator.liu.se
Sun, 25 Oct 2009 18:13:22 +0100
4a198e4b
Fixed side-by-side diff bugs related to binary diff and more.

The fixed bugs:

 * "Binary files differ" did not show up either in unidiff or
   side-by-side-diff.
 * Subproject diffs did not work for side-by-side diffs.
 * The ssdiff link on diff pages did not conserve the path.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ragnar Ouchterlony ragnar@lysator.liu.se
Wed, 16 Sep 2009 18:56:26 +0200
207cc347
Polishing of how the side-by-side diff looks.

Aligned all different files, so that all side-by-side tables look
the same. Also made sure that the tables take up the whole browser
width.

Also various changes to the css to make things easier on the eye.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ragnar Ouchterlony ragnar@lysator.liu.se
Tue, 15 Sep 2009 19:44:37 +0200
c358aa3d
Add possibility to switch between unidiff and side-by-side-diff.

A new config option side-by-side-diffs added, defaulting to 0,
meaning unidiff. Also a query option (ss) is used toggle this.

In the commit page you can switch between the two diff formats by
clicking on the link on the "commit"-row, to the right of (patch).

In the diff page you can switch by using the link at the start
of the page.

All commit-links and diff-links will remember the choice.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ragnar Ouchterlony ragnar@lysator.liu.se
Mon, 14 Sep 2009 20:19:02 +0200
40e174d5
First version of side-by-side diff.

This constitutes the first prototype of a side-by-side diff. It is not
possible to switch between unidiff and side-by-side diff at all at this
stage.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ragnar Ouchterlony ragnar@lysator.liu.se
Sun, 13 Sep 2009 19:36:35 +0200
41934a32
Add support for remote branches

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 07 Nov 2009 19:10:58 +0100
c86e206a
CGIT 0.8.3.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 12 Dec 2009 12:08:14 +0100
24538b07
Fix segfault on ppc when browsing tree
Martins Polakovs martins.polakovs@gmail.com
Thu, 10 Dec 2009 17:34:42 +0159
9bd3a7b1
Clear the whole context

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Daniel Milde info@milde.cz
Sun, 21 Feb 2010 14:38:59 +0100
8d946079
ui-shared.c: fix segfault when repo is empty

PATH_INFO="/$REPONAME/commit/?id=1" QUERY_STRING="id=1" ./cgit.cgi
triggers segfault when the repository is empty and therefore
ctx.qry.head is unset

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Florian Pritz bluewind@xssn.at
Mon, 01 Feb 2010 17:55:37 +0100
a2c6355f
html: properly percent-escape URLs

The only valid characters for a URL are unreserved characters
a-zA-Z0-9_-.~ and the reserved characters !*'();:@&=+$,/?%#[] , as per
RFC 3986.  Everything else must be escaped.  Additionally, the # and
? always have special meaning, and the &, =, and + have special meaning
in a query string, so they too must be escaped.  To make this easier,
a table of escapes is now used so that we do not have to call fmt() for
each character; if the entry is 0, no escaping is needed.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Tue, 09 Feb 2010 10:12:43 -0500
8aab27f2
html: make all strings 'const char *'

None of the html_* functions modify their argument, so they can all be
'const char *' instead of a simple 'char *'.  This removes the need to
cast (or copy) when trying to print a const string.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Mon, 08 Feb 2010 23:04:41 -0500
ce761fde
shared.c: avoid memory leak during diff

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 08 Apr 2010 00:48:36 +0200
581a0c2a
Optionally generate verbose parent links

The new option 'enable-subject-links' must be used to enable the verbose
parent-links in commit view.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 27 Feb 2010 13:12:55 +0100
e15842af
display subject instead of sha1 as link title of parents

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Stefan Naewe stefan.naewe@atlas-elektronik.com
Mon, 15 Feb 2010 09:57:50 +0100
6c1a7364
ui-plain: print directory listings

When a user requests a plain view of a tree (as opposed to a blob),
print out a directory listing rather than giving a 404 Not Found.

Also, fix a segfault when ctx->qry.path is NULL - i.e, when /plain is
requested without a path.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sun, 31 Jan 2010 14:25:03 -0500
74ebf822
ui-plain: more efficient walk_tree()

Git's read_tree_recursive() already filters out the objects by pathname,
so we only have to compare baselen to the expected.  That is, no string
matching is required.

Additionally, if the requested path is a directory, the old code would
walk through all of its immediate children.  This is not necessary, this
so we no longer do that.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sun, 31 Jan 2010 01:07:41 -0500
89082346
ui-plain: remove unused curr_rev variable

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sat, 30 Jan 2010 23:54:16 -0500
31ba37c0
scan-tree: add test for noweb-file in repo dir

If such a file exists, the repo is not added to the repolist.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 28 Feb 2010 18:40:02 +0100
80476b0d
Add 'max-atom-items' config variable

This allows one to specify the items in the RSS feeds

Signed-off-by: Aaron Griffin <agriffin@datalogics.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Aaron Griffin agriffin@datalogics.com
Thu, 04 Feb 2010 18:08:16 -0600
65ced7c0
Add all=1 query param for atom feeds

Displays all items from all branches in one feed

Signed-off-by: Aaron Griffin <agriffin@datalogics.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Aaron Griffin agriffin@datalogics.com
Wed, 03 Feb 2010 18:31:17 -0600
f072bc55
CGIT 0.8.3.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:50:58 +0200
a2cbd3c3
ui-shared.c: path-limit style nitpick

This subjectively makes the path-limit bar less visually intrusive.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 11:35:57 +0200
afc40725
ui-log: Preserve path limit in outgoing links

This allows navigation through the 'log' page/command without losing the
active path limit.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Fri, 11 Jun 2010 14:50:47 +0200
7fdff246
ui-shared: Preserve path limit in "tab bar" links

When using the "tab bar" in the pageheader to navigate between pages, any
path limit in effect on the current page is forgotten in the link to the
target page, even if the target page can interpret and use the path limit
constructively.

Instead, preserve the current page's path limit in the "tab bar" links to
other pages, where the path limit is useful to the target page.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:36 +0200
685872b7
ui-commit: Preserve path limit in links to commit page

This includes adding a path argument to cgit_commit_link() and updating all
its callers. The callers from within the commit page (i.e. the "commit",
"unidiff"/"side-by-side diff" and "parent" links) all preserve the path
limit of the current commit page. All other callers pass NULL (i.e. no path
limit).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:35 +0200
34c2331d
ui-commit: Preserve path limit in links to tree and diff pages

For tree links, the original link is unchanged, but in the case of a path
limit, a subtree link is added to the right of the original tree link.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:34 +0200
eac1b675
ui-patch: Apply path limit to generated patch

Also indicate in the comment section of the patch that a path limit was
applied, too easily see when a generated patch is only partial.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:33 +0200
ab42741c
ui-commit: Limit diff based on path limit in qry.path

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:32 +0200
c46e468d
ui-diff: Teach diffstat to obey path limit

Also indicate in the diffstat header if a path limit is in effect.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:31 +0200
48f7b982
ui-tree: Remove unnecessary path breadcrumb navigation

The path breadcrumb navigation at the top of the 'tree' page has now been
duplicated in ui-shared, which leaves the ui-tree implementation unnecessary.

This patch removes the breadcrumb navigation from ui-tree, and moves the
"(plain)" link that followed the breadcrumb when displaying blobs to the
end of the next line, following the blob SHA1.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:30 +0200
24fd7e54
ui-shared: Teach "breadcrumb" navigation to path limit display beneath tab bar

When a path limit is in effect, and displayed directly beneath the tab bar,
it should offer breadcrumb navigation (like what the 'tree' page does), to
allow changing the path limit easily.

Implementing this requires a robust way to link back to the current page with
a changed ctx->qry.path, but without losing track of the other query
arguments. This is solved by adding the new cgit_self_link() function, which
is then invoked repeatedly by the new cgit_print_path_crumbs() function while
manipulating ctx->qry.path.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:29 +0200
c93ef96a
ui-shared: Display path limit directly beneath tab bar in relevant pages

Design-wise, the path is shown by "expanding" the grey border between the
tab bar and the content area of the page to house the current path limit.

This is only displayed on pages where the path limit is relevant, and only
when a path limit is in effect.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:28 +0200
c8e32954
ui-shared: Replace ctx.qry.path with ctx.qry.vpath

In all cases where ui-shared uses ctx.qry.path, it is done so in the context
of a in-project path, and not in the context in which the 'refs' page or the
'clone'-related functionality uses ctx.qry.path. Make this explicit by using
ctx.qry.vpath instead.

This path introduces no fundamental difference in functionality except for
fixing some minor bugs, for example the Atom feed reference from a
"$repo/refs/heads/" page.

Note that the usage of ctx.qry.path in the other ui-<page>.c files is ok,
since that code presumably is only executed in the context of its own <page>,
so the correct interpretation of ctx.qry.path is never in question.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:27 +0200
0ff143df
struct cgit_cmd: Differentiate between various usages of ctx.qry.path

For many commands/pages (e.g. 'tree', 'diff', 'plain', etc.), the
ctx.qry.path argument is interpreted as a path within the "virtual" project
directory structure. However, for some other commands (notably 'refs', and
the clone-related commands) ctx.qry.path is used in a different context (as
a more or less "real" path within the '.git' directory).

This patch differentiates between these two usages of ctx.qry.path, by
introducing a new variable - ctx.qry.vpath - which is equal to ctx.qry.path
in the former case, and NULL in the latter.

This will become useful in future patches when we want various pages and the
links between them to preserve existing in-project paths.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:26 +0200
0e34c6d1
ui-shared: Remove needless cgit_get_cmd() call, and refactor hc() accordingly

The call to cgit_get_cmd() and the following fallback handling (to "summary"
or "repoindex") in cgit_print_pageheader() is unnecessary, since the same
fallback handling was already done when ctx.qry.page was set when
cgit_get_cmd() was called from process_request() in cgit.c.

As such, hc() can also be rewritten to simply compare the given 'page' string
against ctx.qry.page.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:25 +0200
c3f23d45
ui-shared: Improve const-ness in API

This is needed to prevent const-related warnings in later patches.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:24 +0200
026980c2
Remove unused variable in shared.c

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:23 +0200
9ce5d05f
Fix small typo in cgitrc example

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 01:09:22 +0200
d20313e3
ui-diff: Add links to increase/decrease number of context lines in diffs

Add two links to the "Diffstat" line to show more/less context lines in the
generated diff.

To support this, cgit_commit_link() and cgit_diff_link() has learned to
preserve the ctx.qry.context variable.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 20:15:51 +0200
6180e616
Add URL parameter 'context' for changing the number of context lines in diffs

The new ctx.qry.context variable is picked up by cgit_print_diff(), and
passed via cgit_diff_files() to Git's diff machinery.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Thu, 10 Jun 2010 20:15:27 +0200
a579fb02
ui-log.c: allow commit range as search expression

Inspired-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 19 Jun 2010 14:32:37 +0200
73ac0fb6
Reencode author and committer

When a commit has a specific encoding, this encoding also applies to
the author and committer name and email.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Rémi Lagacé rlagace@cld.ca
Tue, 13 Jul 2010 19:15:09 +0200
ba56a37e
Add support for environment variable expansion

This patch teaches cgit to expand environment variables in certain
cgitrc option values (cache_root, scan-path, include) plus when
finding the location of cgitrc itself.

One use case for this feature is virtual hosting - e.g. by setting
$CGIT_CONFIG='/etc/cgitrc/$HTTP_HOST' in httpd.conf, all virtual
hosts automatically gets their own cgitrc.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 22 Mar 2010 00:09:43 +0100
72ef9135
ui-diff: Add link to ignore/show whitespace changes in diffs

Add a link to the "Diffstat" line to ignore/show whitespace changes in the
generated diff.

To support this, cgit_commit_link() and cgit_diff_link() has learned to
preserve the ctx.qry.ignorews variable.

Signed-off-by: Johan Herland <johan@herland.net>
Johan Herland johan@herland.net
Thu, 24 Jun 2010 17:53:20 +0200
2cc8b99f
Add URL parameter 'ignorews' for optionally ignoring whitespace in diffs

The new ctx.qry.ignorews variable is passed via cgit_diff_files() and
cgit_diff_tree() to Git's diff machinery. This is equivalent to passing
--ignore-all-space to 'git diff'.

Signed-off-by: Johan Herland <johan@herland.net>
Johan Herland johan@herland.net
Thu, 24 Jun 2010 17:52:57 +0200
15c64c5e
CGIT 0.8.3.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 03 Aug 2010 22:50:02 +0200
3687be20
ui-refs.c: avoid segfault on unparsed ref objects

When a ref refers to something other then a commit or tag object, cgit
could segfault when trying to display the tag info.

Noticed-by: Eugene Sajine <euguess@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 03 Aug 2010 22:06:21 +0200
39c2e224
ui-log: Display git notes when present

Signed-off-by: Jeff Smith <whydoubt@yahoo.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jeff Smith whydoubt@yahoo.com
Thu, 29 Jul 2010 09:32:31 -0500
059b3934
ui-commit: Display git notes when present

Signed-off-by: Jeff Smith <whydoubt@yahoo.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jeff Smith whydoubt@yahoo.com
Thu, 29 Jul 2010 09:32:30 -0500
119397b1
Add support for 'enable-gitweb-owner' option

When this option is enabled (which it is by default), cgit will lookup
the 'gitweb.owner' setting in each git config file found when processing
the 'scan-path' option.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 29 Jul 2010 20:38:01 +0200
2e4a9416
Add support for 'remove-suffix' option

When this option is enabled, the '.git' suffix of repository directories
found while processing the 'scan-path' option will be removed.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 29 Jul 2010 19:47:50 +0200
3516502a
Add support for 'project-list' option

This option specifies the location of a projectlist file as used by
gitweb - when 'scan-tree' is later specified, only the projects listed in
the projectlist file will be added.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jason A. Donenfeld Jason@zx2c4.com
Thu, 29 Jul 2010 17:52:29 +0200
48434780
html: fix strcpy bug in convert_query_hexchar

The source and destination strings in strcpy() may not overlap.
Instead, use memmove(), which allows overlap.  This fixes test t0104,
where 'url=foo%2bbar/tree' was being parsed improperly.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Fri, 27 Aug 2010 21:02:27 -0400
c94414a4
t0108-patch: add 'tests_done' to end

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Thu, 26 Aug 2010 22:02:03 -0400
ba1769cb
ui-snapshot: actually compress zip archives

Since cgit linked with git-1.6.0 all zip archives has been uncompressed.
This patch fixes the issue by specifying Z_DEFAULT_COMPRESSION.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 01 Sep 2010 12:13:12 +0000
515edb0d
Add support for "readme" option

The value of this option is used as the default value for repo.readme.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 21 Aug 2010 15:08:01 +0200
797110e3
Add support for 'section-from-path' option

This option can be used to autogenerate section names during scan-path
processing.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 21 Aug 2010 15:44:09 +0200
d187b985
prefer html_raw() to write()

To make the code more consistent, and to not rely on the implementation
of html(), always use html_raw(...) instead of write(htmlfd, ...).

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sat, 04 Sep 2010 14:18:16 -0400
25e8ba19
ui-repolist: fix redefinition of _XOPEN_SOURCE

Previously, ui-repolist.c set _GNU_SOURCE and then included a standard
library before including <git-compat-util.h>.  This was a problem,
because <git-compat-util.h> redefined _XOPEN_SOURCE, which is set
automatically by glibc when _GNU_SOURCE is set.  However,
<git-compat-util.h> already sets _GNU_SOURCE and includes both
<string.h> and <time.h>, so there is no need to define _GNU_SOURCE or
include either header within ui-repolist.c.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sat, 04 Sep 2010 11:49:30 -0400
e4ddc8f7
fix errors in printf-style format strings

There were many places where the arguments to a printf-like function did
not match the format string.  Mostly, these were a missing 'l' flag, but
there were three exceptions:

- In ui-stats.c, a size_t argument must be printed.  C99 has the "%zu"
  flag for this purpose, but not all compilers support this.  Therefore,
  we mimic what git does - use a NO_C99_FORMAT Makefile variable.

- In ui-stats.c, cgit_print_error() was called with a pointer instead of
  a character.

- In ui-log.c, the "columns" argument was never used.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sat, 04 Sep 2010 11:30:18 -0400
a4c58d92
use __attribute__ to catch printf format mistakes

Use "__attribute__((format (printf,N,M)))", as is done in git, do catch
mistakes in printf-style format strings.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Mark Lodato lodatom@gmail.com
Sat, 04 Sep 2010 11:09:57 -0400
aaa3f785
RSS items should always use UTC times

The format uses a 'Z' suffix, which indicates no TZ offset.
Thus we should not respect the local-time config setting here.

Signed-off-by: Aaron Griffin <agriffin@datalogics.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Aaron Griffin agriffin@datalogics.com
Wed, 15 Sep 2010 10:16:33 -0500
af492114
CGIT 0.8.3.4

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 27 Sep 2010 08:00:47 +0200
82a883ed
Use GIT-1.7.3

This fixes http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-2542.

Noticed-by: Silvio Cesare <silvio.cesare@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 27 Sep 2010 07:58:01 +0200
aabc70f7
Use absolute path for scanned repo readme

repo.readme is transformed to an absolute path when read from the config,
so add_repo needs to add "README.html" with the repository path too.

Signed-off-by: Dean Scarff <dos@scarff.id.au>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Dean Scarff dos@scarff.id.au
Thu, 26 Aug 2010 15:01:20 +0800
66df1134
Use example.com in documentation, per RFC 2606

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Mon, 06 Sep 2010 09:31:26 -0400
d7765df1
cgit.css: Add syntax highlighting entries

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Mon, 06 Sep 2010 09:31:25 -0400
6d10c130
Install filter scripts

The syntax-highlighting.sh script is quite useful without any changes.
Installing it by default makes it easier to use and package.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Mon, 06 Sep 2010 09:31:24 -0400
0c3130de
Add Makefile targets to install/uninstall docs

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Mon, 06 Sep 2010 09:31:23 -0400
679f7ef4
Generalize doc generation

This borrows from the git Documentation/Makefile.  The goal is to make
it easier to add new man pages and other documentation as well as to
prevent make from re-generating the documentation needlessly.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Todd Zullinger tmz@pobox.com
Mon, 06 Sep 2010 09:31:22 -0400
c2680325
html.c: use '+' to escape spaces in urls

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 09 Nov 2010 18:15:21 +0100
a3c3c04b
ui-log.c: improve handling of range-search argument

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 09 Nov 2010 20:53:36 +0100
958a95b3
Add vector utility functions

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 09 Nov 2010 19:57:18 +0100
c2bfd40f
ui-log: Move 'Age' column when commit graph is present

When the commit graph is present, we prefer to draw it along the left edge,
and moving the 'Age' column to the right of the 'Author' column, like in gitk.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 18:39:53 +0100
ad230267
ui-log: Line-wrap long commit subjects when showmsg is enabled

When showmsg is disabled ui-log truncates long commit subjects. This is good.
However, the same is not desirable when showmsg is enabled, since you then
end up with a truncated commit subject followed by the rest of the commit
message below.

Instead, when showmsg is enabled (and we're using all this space to display
the entire commit message, anyway), line-wrap the commit subject instead of
truncating it.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 18:39:52 +0100
268b34af
ui-log: Colorize commit graph

Use the existing coloring logic in Git's graph code to color the lines
between commits in the commit graph.

Whereas Git normally uses ANSI color escapes to produce colors, we here
use graph_set_column_colors() to replace those with HTML color escapes,
that embed the graph lines in <span> tags that apply the desired color
using CSS.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 18:39:51 +0100
9a8d39c6
ui-log: Implement support for commit graphs

Teach CGit to print an ASCII art commit graph to the left of the commit
message, similar to 'git log --graph'. The graph adds extra lines (table
rows) to the log when needed to add/remove/shuffle edges in the graph.

When 'showmsg' is enabled, the graph is automatically padded to account
for the extra lines added by the commit message/notes.

This feature is controlled by a new config variable: "enable-commit-graph"
(disabled by default), and individual repos can control it by setting
"repo.enable-commit-graph".

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 18:39:50 +0100
5a36c2a2
ui-log: Change display of full commit messages (and notes)

When showmsg is enabled, ui-log (in addition to the table row containing
the details of the current commit) adds a second table row containing the
remainder of the commit message, and yet another table row containing the
commit notes (if any). The vertical margins between commit subject, commit
message and commit notes are controlled by CSS.

In preparation for the commit graph (which will be printed to the left of
the commit message/notes) we need to eliminate these vertical margins (as
they would produce ugly gaps in the commit graph) and instead achieve them
by adding newlines to the commit message/notes. Furthermore, we can no
longer print the "Notes:" header in the "Age" column, since the graph will
be drawn between the "Age" column and the "Commit message" column.

This patch therefore prepares the commit message and commit notes in a
single buffer (properly formatting the notes using the NOTES_SHOW_HEADER
and NOTES_INDENT flags to format_note()), and then prints the entire
buffer into a single table row.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 18:39:49 +0100
df522794
scan_path(): Do not recurse into hidden directories by default

Paths that start with a period ('.') are considered hidden in the Unix world.
scan_path() should arguably not recurse into these directories by default.
This patch makes it so, and introduces the "scan-hidden-path" config variable
for overriding the new default and revert to the old behaviour (scanning _all_
directories, including hidden .directories).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <larsh@prediktor.no>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 20:41:00 +0100
682adbc0
scan_path(): Improve handling of inaccessible directories

When scanning a tree containing inaccessible directories (e.g. '.ssh'
directories in users' homedirs, or repos with explicitly restricted access),
scan_path() currently causes three lines of "Permissions denied" errors to be
printed to the CGI error log per inaccessible directory:

  Error checking path /home/foo/.ssh: Permission denied (13)
  Error checking path /home/foo/.ssh/.git: Permission denied (13)
  Error opening directory /home/foo/.ssh: Permission denied (13)

This is a side-effect of calling is_git_dir(path) and
is_git_dir(fmt("%s/.git", path) _before_ we try to opendir(path).

By placing the opendir(path) before the two is_git_dir() calls, we reduce the
noise to a single line per inaccessible directory:

  Error opening directory /home/foo/.ssh: Permission denied (13)

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <larsh@prediktor.no>
Johan Herland johan@herland.net
Mon, 15 Nov 2010 20:40:43 +0100
0141b9f8
Use transparent background for the cgit logo

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Thu, 23 Dec 2010 12:47:56 +0100
e52040bf
ssdiff: anchors for ssdiff

Emit anchors to the respective revisions in side-by-side diff view

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Thu, 23 Dec 2010 12:47:55 +0100
808c685e
implement repo.logo and repo.logo-link

Allow for per repo logo and logo-link; Use global logo and logo-link per
default.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Thu, 23 Dec 2010 12:47:54 +0100
9e849950
CGIT 0.8.3.5

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 05 Mar 2011 13:52:39 +0100
d0cb8413
Avoid trailing slash in virtual-root

When setting virtual-root from cgitrc, care is taken to avoid trailing
slashes. But when no virtual-root setting is specified, SCRIPT_FILE
from the web server is used without similar checks. This patch fixes the
inconsistency, which could lead to double-slashes in generated links.

Noticed-by: Wouter Van Hemel <wouter@duodecim.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 05 Mar 2011 13:47:04 +0100
fc384b16
do not infloop on a query ending in %XY, for invalid hex X or Y

When a query ends in say %gg, (or any invalid hex) e.g.,
http://git.gnome.org/browse/gdlmm/commit/?id=%gg
convert_query_hexchar calls memmove(txt, txt+3, 0), and then returns
txt-1, so the loop in http_parse_querystring never terminates.  The
solution is to make the memmove also copy the trailing NUL.
* html.c (convert_query_hexchar): Fix off-by-one error.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jim Meyering meyering@redhat.com
Mon, 28 Feb 2011 12:18:57 +0100
6bf2658f
ui-shared: silence warning

warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type
‘size_t’

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Thu, 23 Dec 2010 12:47:53 +0100
7c2dea03
Makefile: Make `make get-git` work under OpenBSD.

OpenBSD tar(1) defaults to read from "/dev/rst0" when not specifying an
filename and thus fails to extract the Git sourcecode when not passing
stdin as input file descriptor explicitly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer info@cryptocrack.de
Wed, 19 Jan 2011 14:05:48 +0100
facca560
Add advice about scan-path in cgitrc.5.txt

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Julius Plenz plenz@cis.fu-berlin.de
Thu, 10 Mar 2011 17:03:24 +0100
0a799424
fix two encoding bugs

reencode() takes three arguments in the order (txt, from, to), opposed to
reencode_string, which will, like iconv, handle the arguments with from
and to swapped. Fix that (this makes reencode more intuitive).
If src and dst encoding are equivalent, don't do any encoding.

If no special encoding parameter is found within the commit, assume
UTF-8 and explicitly convert to PAGE_ENCODING. The change to reencode()
mentioned above avoids re-encoding a UTF-8 string to UTF-8, for example.

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Julius Plenz plenz@cis.fu-berlin.de
Thu, 10 Mar 2011 17:03:23 +0100
aae06719
Return 404 on command not found

We were returning 200 before. Even 404 is questionable in all cases, but
200 was totally wrong. Also match the case of all of the "Not found"
status messsages.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Dan McGee dpmcgee@gmail.com
Wed, 12 Jan 2011 12:06:08 -0600
42231328
Allow disabling of HTTP clone URLs

If advertising other URLs to your users, you may not want to make this
available through cgit (e.g. if you have the smart HTTP transport set up
elsewhere). Allow disabling the three magic commands that simulate the
git server, but default it to enabled.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Dan McGee dpmcgee@gmail.com
Wed, 12 Jan 2011 12:06:07 -0600
35d33014
Add is_clone flag to available commands

This will be used to make these operations configurable via a config
option.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Dan McGee dpmcgee@gmail.com
Wed, 12 Jan 2011 12:06:06 -0600
ec79265f
fix virtual-root if script-name is ""

In d0cb841 (Avoid trailing slash in virtual-root), virtual-root was set
from script-name using trim_end().  However, if script-name was the
empty string (""), which happens when cgit is used to serve the root
path on a domain (/), trim_end() returns NULL and cgit acts like
virtual-root is not available.  Now, set virtual-root to "" in this
case, which fixes this bug.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Mark Lodato lodatom@gmail.com
Fri, 13 May 2011 19:59:07 -0400
c8ea73ca
ui-repolist.c: do not return random/stale data from read_agefile

When git/date.c:parse_date() cannot parse its input it returns -1. But
read_agefile() checks if the result is different from zero, essentialy
returning random data from the date buffer when parsing fails. This
patch fixes the issue by verifying that the result from parse_date()
is positive.

Noticed-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 23 May 2011 23:10:37 +0200
9afc8832
Avoid null pointer dereference in cgit_print_diff().

When calling cgit_print_diff() with a bad new_rev and a NULL old_rev,
checking for new_rev's parent commit will result in a null pointer
dereference. Returning on an invalid commit before dereferencing fixes
this. Spotted with clang-analyzer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Tue, 05 Apr 2011 10:38:53 +0200
a0bf375a
Avoid null pointer dereference in reencode().

Returning "*txt" if "txt" is a null pointer is a bad thing. Spotted with
clang-analyzer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Tue, 05 Apr 2011 10:35:43 +0200
070e109c
Fix memory leak in http_parse_querystring().

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Thu, 31 Mar 2011 01:21:39 +0200
c9059710
Remove unused variable from cgit_diff_tree().

Seen with "-Wunused-but-set-variable".

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Wed, 30 Mar 2011 19:17:58 +0200
dc1a8ead
shared.c: do not modify const memory

Noticed-by: zhongjj <zhongjj@lemote.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 22 May 2011 12:45:32 +0200
084ca509
tests: add tests for links with space in path and/or args

These tests tries to detect bad links in various pages. On the log page,
there currently exists links which are not properly escaped due to the
use of cgit_fileurl() when building the link. For now, this bug is simply
tagged as such.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 22 May 2011 12:22:56 +0200
afe04daa
tests/setup.sh: add support for known bugs

This patch makes it possible to add tests for known bugs without aborting
the testrun.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 22 May 2011 12:21:31 +0200
74152744
Fix escaping of paths with spaces

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Jonathon Mah me@JonathonMah.com
Sun, 10 Apr 2011 04:10:03 -0700
c2b58ed8
shared.c: use execvp() to execute filter commands

This reintroduces the use of execvp(), since the filter commands doesn't
always contain an absolute path (i.e. snapshot compression filters).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 26 Mar 2011 11:22:35 +0100
b2cf630a
filters: document environment variables in filter scripts

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Wed, 23 Mar 2011 11:57:44 +0100
14f28923
cgit_open_filter: hand down repo configuration to script

The environment variables can be used to (for example) resolve
the following situation:

Suppose a server setup in which each repository has a trac
instance; the commit filter needs to know with which
repository it's dealing in order to be able to resolve the
#123 ticket numbers in the commit messages into hyperlinks
into the correct trac instance.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Wed, 23 Mar 2011 11:57:43 +0100
d87bba84
cgit_open_filter: also take the repo as a parameter

To prepare for handing repo configuration to the
filter script that is executed.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Wed, 23 Mar 2011 11:57:42 +0100
9240a828
new_filter: determine extra_args from filter type

Currently the number of extra arguments is linked hard to the type of
the filter. This is also logical since it would be confusing to have
a different number of arguments for the same type of filter depending
on the context under which the filter is run (unless ofcourse one the
parameters would make the context clear, which is currently not the
case).

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Wed, 23 Mar 2011 11:57:41 +0100
1b5c336c
ui-stats.c: create a control panel for stat options

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 07 Mar 2011 00:00:24 +0100
962a2489
ui-diff.c: create a control panel for diff options

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 06 Mar 2011 23:59:56 +0100
1a64fd2f
html.c: add html_intoption()

This is similar to html_option, but for int values.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 06 Mar 2011 23:57:26 +0100
69382320
Properly escape ampersands inside HTML attributes

Ampersands ("&") appearing inside HTML attributes need to be translated
to "&amp;". Otherwise, invalid XHTML will be generated at various
places, such as at tree views containing links to submodules.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Tue, 24 May 2011 20:38:40 +0200
d885158f
ui-log.c: do not link from age column

The link url wasn't properly escaped, and since the link was identical
to the one used on the commit message it didn't serve any special purpose.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 02 Jun 2011 10:30:26 +0000
2aabeaf8
ui-snapshot.c: remove debug cruft

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 02 Jun 2011 10:26:41 +0000
2a8f5531
scan-tree.c: avoid memory leak

No references are kept to the memory pointed to by the 'rel' variable, so
it should be free()'d before returning from add_repo().

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Signed-off-by: Lars Hjemli <larsh@hjemli.net>
Jamie Couture jamie.couture@gmail.com
Fri, 03 Jun 2011 19:21:01 -0400
7f88d208
ui-plain.c: fix html and links generated by print_dir() and print_dir_entry()

This patch fixes the following issues:
* the base argument usually isn't zero-terminated, so printing base
  without considering baselen will usually generate random garbage
* when the current url represents a directory but doesn't end in a slash,
  relative urls would be incorrect
* using unescaped paths allows XSS

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 12 Jun 2011 20:49:35 +0000
97827522
CGIT 0.9.0.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 12:37:04 +0000
2a0c9dcb
README: update some stale information/add some new

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 13:24:46 +0000
ef13e5ea
cgitrc.5.txt: describe macro expansion of cgitrc options

This is a new feature in cgit-0.9 which was formerly undocumented.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 13 Jun 2011 21:58:39 +0000
a1429dbc
cgit.c: add 'clone-url' setting with support for macro expansion

The current 'clone-prefix' setting has some known issues:
* All repos get the same 'clone-prefix' value since the setting is not
  adopted during repo registration (in cgitrc, or during scan-path traversal),
  but only when the setting is used.
* The generated clone-urls for a repo is a combination of 'clone-prefix', a
  slash and the repo url. This doesn't work well with e.g. ssh-style urls
  like 'git@example.org:repo.git', since the inserted slash will make the
  repo relative to the filesystem root.
* If 'remove-suffix' is enabled, the generated clone-urls will not work for
  cloning (except for http-urls to cgit itself) since they miss the '.git'
  suffix.

The new 'clone-url' setting is designed to avoid the mentioned issues:
* Each repo adopts the default 'clone-url' when the repo is defined. This
  allows different groups of repos to adopt different values.
* The clone-urls for a repo is generated by expanding environment variables
  in a string template without inserting arbitrary characters, hence any
  kind of clone-url can be generated.
* Macro expansion also eases the 'remove-suffix' pain since it's now
  possible to define e.g. 'clone-url=git://foo.org/$CGIT_REPO_URL.git' for
  a set of repos. A furter improvement would be to define e.g.
  $CGIT_REPO_SUFFIX to '.git' for all repos which had their url prettified,
  or to store the original $CGIT_REPO_URL in e.g. $CGIT_REPO_REAL_URL before
  suffix removal.

Reviewed-by: Ferry Huberts <mailings@hupie.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 06 Jun 2011 20:49:13 +0000
3ec6b309
cgit.c: always setup cgit repo environment variables

When cgit learned to setup environment variables for certain repo
settings before invoking a filter process, the setup occurred inside
cgit_open_filter().

This patch moves the setup out of cgit_open_filter() and into
prepare_repo_cmd() to prepare for additional uses of these variables.

Reviewed-by: Ferry Huberts <mailings@hupie.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 06 Jun 2011 19:29:58 +0000
46ca32e0
cgitrc.5.txt: document repo.module-link

The global module-link option can be overridden per repo, but this has
never been documented.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 15 Jun 2011 09:58:42 +0200
9900ac02
cgit.c: improve error message when git repo cannot be accessed

The current 'Not a git repository' error message is not very helpful,
since it doesn't state the cause of the problem.

This patch uses errno to provide a hint of the underlying problem. It
would have been even better to give the exact cause (e.g. for ENOENT it
would be nice to know which file/directory is missing), but that would
require reimplementing setup_git_directory_gently() which seems a bit
overkill.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sat, 18 Jun 2011 14:32:43 +0200
877ff681
tests: fix failures when CDPATH is set

Some tests would otherwise fail because commands such as
  cd trash/repos/foo && git rev-list --reverse HEAD | head -1
would return 2 lines instead of 1: the 'cd' command also
prints the path when CDPATH is set.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Thu, 21 Jul 2011 14:43:54 +0200
654ebb55
CGIT 0.9.0.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 21 Jul 2011 14:23:50 +0000
9cae75d0
html.c: avoid out-of-bounds access for url_escape_table

This fixes a segfault for me with with -O2 optimization on x86
with gcc (Debian 4.4.5-8) 4.4.5

I can reliably reproduce it with the following parameters
when pointed to the git.git repository:

PATH_INFO='/git-core.git/diff/'
QUERY_STRING='id=2b93bfac0f5bcabbf60f174f4e7bfa9e318e64d5&id2=d6da71a9d16b8cf27f9d8f90692d3625c849cbc8'

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Eric Wong normalperson@yhbt.net
Thu, 21 Jul 2011 03:24:54 +0000
bebe89d7
Fix potential XSS vulnerability in rename hint

The file name displayed in the rename hint should be escaped to avoid
XSS. Note that this vulnerability is only applicable when an attacker
has gained push access to the repository.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Fri, 22 Jul 2011 13:47:19 +0200
1e25ac5b
Remove dead initialization in cgit_parse_commit()

The value stored to "t" during its initialization gets overwritten in
any case, so just leave it uninitialized. Spotted by clang-analyzer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lukas Fleischer cgit@cryptocrack.de
Thu, 21 Jul 2011 23:04:53 +0200
f2ced535
Fix diff mode switching when side-by-side-diffs=1

When side-by-side-diffs=1 was set in cgitrc, specyfing 'ss=0' in the query-
string would not switch to unified diffs. This patch fixes the issue by
introducing a separate variable to track the occurrence of "ss" in the
querystring.
Tim Chen timchen1@gmail.com
Tue, 03 Jan 2012 16:02:14 +0000
0b6a716d
ui-log.c: do not show remote heads if enable-remote-branches=0

If remote branches are not enabled, the branches are still listed in
the log view. This patch removes them if enable-remote-branches=0.
Georg Müller georgmueller@gmx.net
Tue, 03 Jan 2012 15:30:50 +0000
7530d94f
Add sort parameter to pager of repo list

When the repolist is paged, the page-links are missing the sort parameter,
causing the initial page to be custom sorted, but any clicked page will
then be with the default sort order again.
Tobias Grimm git@e-tobi.net
Sun, 31 Jul 2011 02:44:05 +0200
e19f7d71
ui-ssdiff: move LCS table away from the stack

Printing deferred line changes for files containing long lines would
cause a segfault.

- limit LCS table size: 128x128.
- move LCS table to global context: avoid allocating/freeing memory
  for every deferred line change.

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Jamie Couture jamie.couture@gmail.com
Sat, 17 Sep 2011 18:25:01 -0400
fbd254d5
Makefile: fetch git tarballs from http://hjemli.net/git/git/

The git tarballs are currently not available from kernel.org, so for now
the makefile will download autogenerated tarballs from cgit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 03 Jan 2012 16:43:33 +0000
dad620ee
fix css color value and vertical-align value
Norberto Lopes nlopes.ml@gmail.com
Tue, 22 Nov 2011 17:59:26 -0800
94b7c76e
Fix segmentation fault in empty repository

When a repository is empty, the ATOM feed link is written in the header,
but this involves formatting ctx->qry.head which is NULL in this case.
With glibc, vsnprintf formats "%s" with a NULL input as "(null)" but on
Solaris this results in a segmentation fault.  Since we don't have a
meaningful head for the atom feed in an empty repository, it's simplest
not to write out the link element at all.

Signed-off-by: John Keeping <john@metanate.com>
John Keeping john@metanate.com
Thu, 24 Nov 2011 11:54:47 +0000
21418ec4
segfault fix on some bogus requests

ctx.qry.head can be NULL in some cases due to bad requests
by weird bots.  I managed to reproduce with:

   PATH_INFO=/repo.git/shop.php QUERY_STRING=id=

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong normalperson@yhbt.net
Wed, 04 Jan 2012 09:01:51 +0000
6a575b89
use correct type for sizeof

**L would have worked well too.  Depending on the distribution sizeof *L
may return 8 instead of 4. **L is preferable, but since we don't expect
this datatype to change very often, sizeof int is less subtle and easier
to understand.

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Jamie Couture jamie.couture@gmail.com
Wed, 11 Jan 2012 22:38:49 -0500
19c31231
ui-ssdiff.c: correct length check for LCS table

Each individual string may be too long for its respective
dimension of the LCS table.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong normalperson@yhbt.net
Wed, 04 Jan 2012 08:59:15 +0000
e032761a
CGIT-0.9.0.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Sun, 18 Mar 2012 10:16:27 +0000
f50be7fd
filters/syntax-highlighting.sh: work around highlight --force bug
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:48:01 +0000
375353ca
filters/highlight.sh: manually support highlight version 2 and 3
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:38:26 +0000
561959cf
tests: properly quote arguments to printf

v2: incorporate remarks of Lukas

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:43:50 +0100
f8492f79
tests: handle paths with whitespace

v2: incorporate remarks of Lukas

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Ferry Huberts ferry.huberts@pelagic.nl
Sun, 18 Mar 2012 11:43:49 +0100
3fbaf097
Do not provide a default value for `module-link`

The old default value was an abomination which never should have been
allowed to see the light of day.

This patch removes the default, which is a backwards incompatible change
with low probability of causing anyone any real trouble (a repo with
submodules, displayed by cgit using the default value of `module-link`,
is very unlikely to actually generate working links).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 15 Jun 2011 10:13:15 +0200
7421857b
ui-plain.c: add support for path-selected submodule links

In ui-plain.c, the links generated for submodule entry ignored the fact
that the entry was in fact a submodule. This patch adds proper submodule
links to the plain directory listings.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 15 Jun 2011 10:10:41 +0200
6857bec5
ui-tree.c: add support for path-selected submodule links

The current 'repo.module-link' option is sufficient when all gitlinks
in a repository can be converted to commit links in a uniform way, but
not when different submodules/paths needs different settings.

This patch adds support for 'repo.module-link.<path>', which will be
used for linking to submodules at paths matching one such entry.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Wed, 15 Jun 2011 10:04:13 +0200
5293c8b7
ui-repolist.c: fallback to "master" if no default branch is specified

When looking for the modtime of a repo we used to rely on repo.defbranch
having a value. This is no longer true so this patch provides a default
value when needed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Tue, 19 Jul 2011 09:34:18 +0000
8d7c2ec2
cgit.c: use resolve_ref() to guess_defbranch()

The resolve_ref() function handles reading of git- and filesystem
symbolic links (including proper whitespace trimming) and packed refs.
There's no point in reimplementing this function in cgit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 20 Jun 2011 22:52:51 +0000
e95c70d4
Only guess default branch when a repo page is requested

There's no need to invoke guess_defbranch() for each repo during
scan-path, since repo.defbranch is only used when repo content is
being displayed.

Also, some users prefer to register their projects manually in cgitrc
but they got no benefit from the new repo.defbranch handling.

This patch tries to rectify these issues by only invoking guess_defbranch()
when needed, regardless of how the repo was registered.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 20 Jun 2011 20:59:10 +0200
d711de55
guess default branch from HEAD

This is a saner alternative than hardcoding the default branch to be
"master". The add_repo() function will now check for a symbolic ref in
repo_path/HEAD. If there is a suitable one, overwrite repo->defbranch
with it. Note that you'll need to strip the newline from the file (->
len-17).

If HEAD is a symbolic link pointing directly to a branch below
refs/heads/, do a readlink() instead to find the ref name.

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Julius Plenz plenz@cis.fu-berlin.de
Thu, 07 Apr 2011 12:59:24 +0200
d01c600c
ui_plain: automatically lookup mimetype when mimetype-file is set

For sites that do not want to configure mime types by hand but
still want the correct mime type for 'plain' blobs, configuring
a mime type file is made possible. This is handy since such a
file is normally already provided (at least on Linux systems).

Also, this reflects the gitweb option '$mimetypes_file'

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Ferry Huberts ferry.huberts@pelagic.nl
Tue, 19 Jul 2011 10:51:58 +0200
59fe348d
cgit_print_snapshot_links(): Free prefix variable

Fixes following memory leak seen with "PATH_INFO=/cgit/commit/":

    ==16894== 12 bytes in 1 blocks are definitely lost in loss record 9 of 92
    ==16894==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==16894==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==16894==    by 0x46CAC8: xstrdup (wrapper.c:35)
    ==16894==    by 0x414E34: cgit_print_snapshot_links (ui-shared.c:926)
    ==16894==    by 0x40CFA1: cgit_print_commit (ui-commit.c:102)
    ==16894==    by 0x407B06: commit_fn (cmd.c:54)
    ==16894==    by 0x405E16: process_request (cgit.c:574)
    ==16894==    by 0x4074C8: cache_process (cache.c:322)
    ==16894==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 13:25:38 +0100
bc2f5a6d
cgit_print_commit(): Free tmp variable

Fixes following memory leak seen with "PATH_INFO=/cgit/commit/":

    ==16894== 7 bytes in 1 blocks are definitely lost in loss record 4 of 92
    ==16894==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==16894==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==16894==    by 0x46CAC8: xstrdup (wrapper.c:35)
    ==16894==    by 0x40CD6F: cgit_print_commit (ui-commit.c:70)
    ==16894==    by 0x407B06: commit_fn (cmd.c:54)
    ==16894==    by 0x405E16: process_request (cgit.c:574)
    ==16894==    by 0x4074C8: cache_process (cache.c:322)
    ==16894==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 13:25:37 +0100
985d6ca7
cgit_print_tree(): Free curr_rev after usage

Fixes following memory leak seen with "PATH_INFO=/cgit/tree/":

    ==15715== 7 bytes in 1 blocks are definitely lost in loss record 4 of 51
    ==15715==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==15715==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==15715==    by 0x46CAA8: xstrdup (wrapper.c:35)
    ==15715==    by 0x418A4C: cgit_print_tree (ui-tree.c:274)
    ==15715==    by 0x407D91: tree_fn (cmd.c:131)
    ==15715==    by 0x405E16: process_request (cgit.c:574)
    ==15715==    by 0x4074C8: cache_process (cache.c:322)
    ==15715==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 13:25:36 +0100
0ffdc46f
find_default_branch(): Free refmatch after usage

Fixes following memory leak seen with "PATH_INFO=/cgit/refs/":

    ==13408== 7 bytes in 1 blocks are definitely lost in loss record 4 of 52
    ==13408==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==13408==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==13408==    by 0x46CA78: xstrdup (wrapper.c:35)
    ==13408==    by 0x405840: find_current_ref (cgit.c:426)
    ==13408==    by 0x44BE5A: do_one_ref (refs.c:527)
    ==13408==    by 0x44D3E0: do_for_each_ref_in_dir (refs.c:553)
    ==13408==    by 0x44D85A: do_for_each_ref (refs.c:1298)
    ==13408==    by 0x405889: find_default_branch (cgit.c:438)
    ==13408==    by 0x405AC4: prepare_repo_cmd (cgit.c:490)
    ==13408==    by 0x405D97: process_request (cgit.c:557)
    ==13408==    by 0x407490: cache_process (cache.c:322)
    ==13408==    by 0x406C18: main (cgit.c:864)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 13:25:35 +0100
fab385ef
print_tag_downloads(): Free ref variable

Make sure the ref variable is freed if we build a
"$basename-$version"-style ref.

This fixes following memory leak seen with "PATH_INFO=/cgit/refs/":

    ==8784== 323 bytes in 29 blocks are definitely lost in loss record 41 of 53
    ==8784==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==8784==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==8784==    by 0x46CA28: xstrdup (wrapper.c:35)
    ==8784==    by 0x410DA6: print_tag_downloads (ui-refs.c:115)
    ==8784==    by 0x410F02: print_tag (ui-refs.c:141)
    ==8784==    by 0x41128B: cgit_print_tags (ui-refs.c:230)
    ==8784==    by 0x41134D: cgit_print_refs (ui-refs.c:250)
    ==8784==    by 0x407C85: refs_fn (cmd.c:105)
    ==8784==    by 0x405DDF: process_request (cgit.c:566)
    ==8784==    by 0x407490: cache_process (cache.c:322)
    ==8784==    by 0x406C18: main (cgit.c:864)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 13:25:34 +0100
1268afe8
Free reflists after usage

Free reflists in cgit_print_branches() and in cgit_print_tags() before
returning reflist structures to the stack.

This fixes following memory leaks seen with "PATH_INFO=/cgit/refs/":

    ==5710== 1,312 (32 direct, 1,280 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 71
    ==5710==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5710==    by 0x4C2C2FF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5710==    by 0x46CA9B: xrealloc (wrapper.c:100)
    ==5710==    by 0x40AAA6: cgit_add_ref (shared.c:156)
    ==5710==    by 0x40ABC4: cgit_refs_cb (shared.c:186)
    ==5710==    by 0x44BCBA: do_one_ref (refs.c:527)
    ==5710==    by 0x44D240: do_for_each_ref_in_dir (refs.c:553)
    ==5710==    by 0x44D6BA: do_for_each_ref (refs.c:1298)
    ==5710==    by 0x410FE2: cgit_print_branches (ui-refs.c:191)
    ==5710==    by 0x4111E9: cgit_print_refs (ui-refs.c:244)
    ==5710==    by 0x407C85: refs_fn (cmd.c:105)
    ==5710==    by 0x405DDF: process_request (cgit.c:566)
    ==5710==
    ==5710== 6,846 (256 direct, 6,590 indirect) bytes in 1 blocks are definitely lost in loss record 68 of 71
    ==5710==    at 0x4C2C25E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5710==    by 0x46CA9B: xrealloc (wrapper.c:100)
    ==5710==    by 0x40AAA6: cgit_add_ref (shared.c:156)
    ==5710==    by 0x40ABC4: cgit_refs_cb (shared.c:186)
    ==5710==    by 0x44BCBA: do_one_ref (refs.c:527)
    ==5710==    by 0x44D240: do_for_each_ref_in_dir (refs.c:553)
    ==5710==    by 0x44D6EC: do_for_each_ref (refs.c:1288)
    ==5710==    by 0x4110D5: cgit_print_tags (ui-refs.c:218)
    ==5710==    by 0x4111FD: cgit_print_refs (ui-refs.c:246)
    ==5710==    by 0x407C85: refs_fn (cmd.c:105)
    ==5710==    by 0x405DDF: process_request (cgit.c:566)
    ==5710==    by 0x407490: cache_process (cache.c:322)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 13:25:33 +0100
1a5e8633
ui-shared.c: Remove unused function print_archive_ref()

This is no longer used as of commit f135569b.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 08:52:35 +0100
71926bfb
ui-shared.c: Remove unused function cgit_currurl()

This is no longer used as of commit 0c8e184e.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 08:52:34 +0100
bafab423
Mark several functions/variables static

Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Lukas Fleischer cgit@cryptocrack.de
Mon, 04 Mar 2013 08:52:33 +0100
bd6f5683
tests: t0107: support older and/or non-GNU tar

The untar tests for various compression algorithms use shortcut options
from GNU tar to handle decompression.  These options may not be provided
by non-GNU tar nor even by slightly older GNU tar versions which ship on
many systems.

An example of the latter case is the --zstd option.  This was added in
GNU tar-1.32 (2019-02-23)¹.  This version of tar is not provided by
CentOS/RHEL, in particular.  In Debian, --zstd has been backported to
the tar-1.30 release.

Avoid the requirement on any specific implementations or versions of tar
by piping decompressed output to tar.  This is compatible with older GNU
tar releases as well as tar implementations from other vendors.  (It may
also be a slight benefit that this more closely matches what the
snapshot creation code does.)

¹ Technically, the --zstd option was first released in tar-1.31
  (2019-01-02), but this release was very short-lived and is no longer
  listed on the GNU Tar release page.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Todd Zullinger tmz@pobox.com
Tue, 29 Dec 2020 14:18:01 -0500
f69626c6
md2html: use sane_lists extension

This allows for cleaner nesting semantics and matches github more
closely.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Jason A. Donenfeld Jason@zx2c4.com
Fri, 04 Dec 2020 13:13:23 +0100
cef27b67
git: update to v2.30.0

Update to git version v2.30.0, this requires changes for these
upstream commits:

* 88894aaeeae92e8cb41143cc2e045f50289dc790
  blame: simplify 'setup_scoreboard' interface

* 1fbfdf556f2abc708183caca53ae4e2881b46ae2
  banned.h: mark non-reentrant gmtime, etc as banned

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 28 Dec 2020 23:27:13 +0100
b1739247
git: update to v2.29.2

Update to git version v2.29.2.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Fri, 30 Oct 2020 22:22:32 +0100
fe99c76e
git: update to v2.29.1

Update to git version v2.29.1. No functional change, but we want latest
and greated version number, no? 😜

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 27 Oct 2020 10:39:46 +0100
5258c297
git: update to v2.32.0

Update to git version v2.32.0, this requires changes for these
upstream commits:

* 47957485b3b731a7860e0554d2bd12c0dce1c75a
  tree.h API: simplify read_tree_recursive() signature

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 18 May 2021 22:49:13 +0200
6dbbffe0
git: update to v2.31.1

Update to git version v2.31.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 18 May 2021 21:54:23 +0200
62eb8db4
md2html: use proper formatting for hr

This addressed a non-existent background image and made the element
invisible. Drop the style and use something sane.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Tue, 31 Mar 2020 14:53:42 +0200
d889cae8
git: update to v2.31.0

Update to git version v2.31.0, this requires changes for these
upstream commits:

* 36a317929b8f0c67d77d54235f2d20751c576cbb
  refs: switch peel_ref() to peel_iterated_oid()

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Mon, 15 Mar 2021 22:48:26 +0100
4ffadc1e
git: update to v2.30.1

Update to git version v2.30.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
Christian Hesse mail@eworm.de
Wed, 10 Feb 2021 16:13:53 +0100