]> granicus.if.org Git - cgit/log
cgit
15 months agoconfig: make empty js= omit script tag master
Samuel Lidén Borell [Sat, 7 Jan 2023 09:32:07 +0000 (10:32 +0100)]
config: make empty js= omit script tag

According to the cgitrc man page, an empty js= value should cause the
script tag to be omitted. But instead, a script tag with an empty URL
is emitted. The same applies to css. So, skip emitting a tag if the
specified string is empty.

Signed-off-by: Samuel Lidén Borell <samuel@kodafritt.se>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agojs: add dynamic age update
Andy Green [Sun, 24 Jun 2018 07:05:20 +0000 (15:05 +0800)]
js: add dynamic age update

This patch updates the emitted "ages" dynamically on the client side.

After updating on completion of the document load, it sets a timer
to update according to the smallest age it found.  If there are any
ages listed in minutes, then it will update again in 10s.  When the
most recent age is in hours, it updates every 5m.  If days, then
every 30m and so on.

This keeps the cost of the dynamic updates at worst once per 10s.
The updates are done entirely on the client side without contact
with the server.

To make this work reliably, since parsing datetimes is unreliable in
browser js, the unix time is added as an attribute to all age spans.

To make that reliable cross-platform, the unix time is treated as a
uint64_t when it is formatted for printing.

The rules for display conversion of the age is aligned with the
existing server-side rules in ui-shared.h.

If the client or server-side time are not synchronized by ntpd etc,
ages shown on the client will not relate to the original ages computed
at the server.  The client updates the ages immediately when the
DOM has finished loading, so in the case the times at the server and
client are not aligned, this patch changes what the user sees on the
page to reflect patch age compared to client time.

If the server and client clocks are aligned, this patch makes no
difference to what is seen on the page.

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agoconfig: add js
Andy Green [Sat, 23 Jun 2018 10:25:53 +0000 (18:25 +0800)]
config: add js

Just like the config allows setting css URL path, add a config for
setting the js URL path

Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agocss: change to be a list
Andy Green [Tue, 3 Jul 2018 03:33:59 +0000 (11:33 +0800)]
css: change to be a list

Without changing the default behaviour of including
/cgit.css if nothing declared, allow the "css" config
to be given multiple times listing one or more
alternative URL paths to be included in the document
head area.

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agocgitrc: handle value "0" for max-repo-count
Christian Hesse [Mon, 16 Jul 2018 14:27:39 +0000 (16:27 +0200)]
cgitrc: handle value "0" for max-repo-count

Setting max-repo-count to "0" makes cgit loop forever generating page
links. Make this a special value to show all repositories.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agocache: tolerate short writes in print_slot
Hristo Venev [Sat, 7 May 2022 17:07:00 +0000 (20:07 +0300)]
cache: tolerate short writes in print_slot

sendfile() can return after a short read/write, so we may need to call
it more than once. As suggested in the manual page, we fall back to
read/write if sendfile fails with EINVAL or ENOSYS.

On the read/write path, use write_in_full which deals with short writes.

Signed-off-by: Hristo Venev <hristo@venev.name>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoglobal: use release_commit_memory()
John Keeping [Sun, 13 Feb 2022 15:34:50 +0000 (15:34 +0000)]
global: use release_commit_memory()

Instead of calling two separate Git functions to free memory associated
with a commit object, use Git's wrapper which does this.  This also
counts as a potential future bug fix since release_commit_memory() also
resets the parsed state of the commit, meaning any attempt to use it in
the future will correctly fill out the fields again.

release_commit_memory() does not set parents to zero, so keep that for
additional safety in case CGit checks this without calling
parse_commit() again.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agocss: reset font size for blame oid
John Keeping [Sun, 13 Feb 2022 15:35:29 +0000 (15:35 +0000)]
css: reset font size for blame oid

In Firefox, the hashes in the blame UI are out of step with the line
number and content leading to ever increasing vertical misalignment.

This is caused by the .oid class setting font-size to 90%, so override
this back to 100% for the blame case, bringing the height of lines in
all three columns of the table back into step.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-blame: add a link to the parent commit in blame
John Keeping [Sun, 13 Feb 2022 15:29:06 +0000 (15:29 +0000)]
ui-blame: add a link to the parent commit in blame

When walking through the history, it is useful to quickly see the same
file at the previous revision, so add a link to do this.

It would be nice to link to the correct line with an additional
fragment, but this requires significantly more work so it can be done as
an enhancement later.  (ent->s_lno is mostly the right thing, but it is
the line number in the post-image of the target commit whereas the link
is to the parent of that commit, i.e. the pre-image of the target.)

Suggested-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoabout: allow to give head from query
Christian Hesse [Mon, 10 Jan 2022 09:15:33 +0000 (10:15 +0100)]
about: allow to give head from query

Reading the README from repository used to be limited to default
branch or a branch given in configuration. Let's allow a branch
from query if not specified explicitly.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agohtml: fix handling of null byte
Peter Prohaska [Wed, 11 Nov 2020 21:16:21 +0000 (22:16 +0100)]
html: fix handling of null byte

A return value of `len` or more means that the output was truncated.

Signed-off-by: Peter Prohaska <pitrp@web.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agoui-atom: generate valid Atom feeds
June McEnroe [Tue, 8 Jun 2021 20:21:10 +0000 (20:21 +0000)]
ui-atom: generate valid Atom feeds

Fixes several RFC 4287 violations:

> 4.1.1. The "atom:feed" Element
>    o  atom:feed elements MUST contain exactly one atom:id element.
>    o  atom:feed elements SHOULD contain one atom:link element with a rel
>       attribute value of "self".  This is the preferred URI for
>       retrieving Atom Feed Documents representing this Atom feed.
>    o  atom:feed elements MUST contain exactly one atom:updated element.

An atom:id element is generated from cgit_currentfullurl(), and an
atom:link element with a rel attribute of "self" is generated with
the same URL. An atom:updated element is generated from the date
of the first commit in the revision walk.

> 4.1.2.  The "atom:entry" Element
>    o  atom:entry elements MUST NOT contain more than one atom:content
>       element.

The second atom:content element with the type of "xhtml" is removed.

> 4.2.6.  The "atom:id" Element
>    Its content MUST be an IRI, as defined by [RFC3987].  Note that the
>    definition of "IRI" excludes relative references.  Though the IRI
>    might use a dereferencable scheme, Atom Processors MUST NOT assume it
>    can be dereferenced.

The atom:id elements for commits now use URNs in the "sha1" or
"sha256" namespaces. Although these are not registered URN namespaces,
they see use in the wild, for instance as part of magnet URIs.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-shared: use owner-filter for repo page headers
June McEnroe [Thu, 4 Feb 2021 22:10:14 +0000 (17:10 -0500)]
ui-shared: use owner-filter for repo page headers

Previously it was only used if owners were displayed on the index.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-commit: use git raw note format
Chris Mayo [Sun, 26 May 2019 16:57:01 +0000 (17:57 +0100)]
ui-commit: use git raw note format

Currently a commit note is shown as:

    Notes

      Notes:
          <note text>

Change to:

    Notes
      <note text>

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Reviewed-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-repolist,ui-shared: remove redundant title on repo anchors
Chris Mayo [Fri, 15 Mar 2019 20:17:05 +0000 (20:17 +0000)]
ui-repolist,ui-shared: remove redundant title on repo anchors

The title attribute was being set to the same value as the anchor
element text.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Reviewed-by: Eric Wong <e@80x24.org>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-commit: show subject in commit page title
June McEnroe [Fri, 21 Feb 2020 08:07:50 +0000 (08:07 +0000)]
ui-commit: show subject in commit page title

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-tree: show symlink targets in tree listing
June McEnroe [Thu, 19 Dec 2019 21:55:05 +0000 (21:55 +0000)]
ui-tree: show symlink targets in tree listing

Add links to symbolic link targets in tree listings, formatted like
"ls -l".  Path normalization collapses any ".." components of the link.

Also fix up memory link on error path.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agoui-tree,ui-blame: bail from blame if blob is binary
June McEnroe [Wed, 18 Dec 2019 21:30:12 +0000 (21:30 +0000)]
ui-tree,ui-blame: bail from blame if blob is binary

This avoids piping binary blobs through the source-filter. Also prevent
robots from crawling it, since it's expensive.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 months agogit: update to v2.39.0
Christian Hesse [Mon, 12 Dec 2022 15:21:23 +0000 (16:21 +0100)]
git: update to v2.39.0

Update to git version v2.39.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.38.2
Christian Hesse [Mon, 12 Dec 2022 15:18:28 +0000 (16:18 +0100)]
git: update to v2.38.2

Update to git version v2.38.2, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.38.1
Christian Hesse [Tue, 18 Oct 2022 19:22:41 +0000 (21:22 +0200)]
git: update to v2.38.1

Update to git version v2.38.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.38.0
Christian Hesse [Fri, 16 Sep 2022 09:31:24 +0000 (11:31 +0200)]
git: update to v2.38.0

Update to git version v2.38.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.37.3
Christian Hesse [Tue, 30 Aug 2022 20:42:19 +0000 (22:42 +0200)]
git: update to v2.37.3

Update to git version v2.37.3, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.37.2
Christian Hesse [Thu, 11 Aug 2022 20:07:02 +0000 (22:07 +0200)]
git: update to v2.37.2

Update to git version v2.37.2, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.37.1
Christian Hesse [Tue, 12 Jul 2022 19:16:29 +0000 (21:16 +0200)]
git: update to v2.37.1

Update to git version v2.37.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.37.0
Christian Hesse [Tue, 14 Jun 2022 10:48:56 +0000 (12:48 +0200)]
git: update to v2.37.0

Update to git version v2.37.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agogit: update to v2.36.1
Christian Hesse [Mon, 9 May 2022 07:29:05 +0000 (09:29 +0200)]
git: update to v2.36.1

Update to git version v2.36.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
16 months agoshared: fix bad free in cgit_diff_tree
June McEnroe [Tue, 17 May 2022 21:50:53 +0000 (21:50 +0000)]
shared: fix bad free in cgit_diff_tree

Since git commit 244c27242f44e6b88e3a381c90bde08d134c274b,

> diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)

calling diff_flush calls free(3) on opts.pathspec.items, so it can't
be a pointer to a stack variable.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.36.0
Christian Hesse [Mon, 4 Apr 2022 19:00:33 +0000 (21:00 +0200)]
git: update to v2.36.0

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

95433eeed9eac439eb21eb30105354b15e71302e
  diff: add ability to insert additional headers for paths

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.35.3
Christian Hesse [Mon, 18 Apr 2022 20:10:41 +0000 (22:10 +0200)]
git: update to v2.35.3

Update to git version v2.35.3, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.35.2
Christian Hesse [Tue, 12 Apr 2022 17:01:23 +0000 (19:01 +0200)]
git: update to v2.35.2

Update to git version v2.35.2, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.35.1
Christian Hesse [Sat, 29 Jan 2022 09:20:25 +0000 (10:20 +0100)]
git: update to v2.35.1

Update to git version v2.35.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.35.0
Christian Hesse [Tue, 11 Jan 2022 10:03:29 +0000 (11:03 +0100)]
git: update to v2.35.0

Update to git version v2.35.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.34.1
Christian Hesse [Wed, 24 Nov 2021 20:12:12 +0000 (21:12 +0100)]
git: update to v2.34.1

Update to git version v2.34.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.34.0
Christian Hesse [Wed, 3 Nov 2021 14:32:17 +0000 (15:32 +0100)]
git: update to v2.34.0

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

abf897bacd2d36b9dbd07c70b4a2f97a084704ee
  string-list.[ch]: remove string_list_init() compatibility function

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.33.0
Christian Hesse [Sun, 8 Aug 2021 15:55:53 +0000 (17:55 +0200)]
git: update to v2.33.0

Update to git version v2.33.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agogit: update to v2.32.0
Christian Hesse [Tue, 18 May 2021 20:49:13 +0000 (22:49 +0200)]
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>
2 years agogit: update to v2.31.1
Christian Hesse [Tue, 18 May 2021 19:54:23 +0000 (21:54 +0200)]
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>
2 years agomd2html: use proper formatting for hr
Christian Hesse [Tue, 31 Mar 2020 12:53:42 +0000 (14:53 +0200)]
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>
3 years agogit: update to v2.31.0 ch/git-2-31-0
Christian Hesse [Mon, 15 Mar 2021 21:48:26 +0000 (22:48 +0100)]
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>
3 years agogit: update to v2.30.1
Christian Hesse [Wed, 10 Feb 2021 15:13:53 +0000 (16:13 +0100)]
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>
3 years agotests: t0107: support older and/or non-GNU tar
Todd Zullinger [Tue, 29 Dec 2020 19:18:01 +0000 (14:18 -0500)]
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>
3 years agomd2html: use sane_lists extension
Jason A. Donenfeld [Fri, 4 Dec 2020 12:13:23 +0000 (13:13 +0100)]
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>
3 years agogit: update to v2.30.0
Christian Hesse [Mon, 28 Dec 2020 22:27:13 +0000 (23:27 +0100)]
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>
3 years agogit: update to v2.29.2
Christian Hesse [Fri, 30 Oct 2020 21:22:32 +0000 (22:22 +0100)]
git: update to v2.29.2

Update to git version v2.29.2.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
3 years agogit: update to v2.29.1
Christian Hesse [Tue, 27 Oct 2020 09:39:46 +0000 (10:39 +0100)]
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>
3 years agotests: try with commit-graph
Christian Hesse [Wed, 21 Oct 2020 20:16:57 +0000 (22:16 +0200)]
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>
3 years agotests: do not copy snapshots to /tmp/
Christian Hesse [Wed, 21 Oct 2020 19:31:52 +0000 (21:31 +0200)]
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>
3 years agoglobal: replace hard coded hash length ch/sha256
Christian Hesse [Tue, 20 Oct 2020 21:46:09 +0000 (23:46 +0200)]
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>
3 years agoglobal: replace references to 'sha1' with 'oid'
Christian Hesse [Tue, 20 Oct 2020 21:32:45 +0000 (23:32 +0200)]
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>
3 years agogit: update to v2.29.0
Christian Hesse [Tue, 6 Oct 2020 14:32:08 +0000 (16:32 +0200)]
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>
3 years agogit: update to v2.28.0
Christian Hesse [Mon, 27 Jul 2020 18:36:14 +0000 (20:36 +0200)]
git: update to v2.28.0

Update to git version v2.28.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
3 years agogit: update to v2.27.0
Christian Hesse [Tue, 2 Jun 2020 08:10:15 +0000 (10:10 +0200)]
git: update to v2.27.0

Update to git version v2.27.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years agogit: update to v2.26.0
Christian Hesse [Mon, 9 Mar 2020 08:51:05 +0000 (09:51 +0100)]
git: update to v2.26.0

Update to git version v2.26.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years agoBump version v1.2.3
Jason A. Donenfeld [Fri, 13 Mar 2020 23:49:52 +0000 (17:49 -0600)]
Bump version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
4 years agoglobal: use proper accessors for maybe_tree
Jason A. Donenfeld [Fri, 13 Mar 2020 02:52:35 +0000 (20:52 -0600)]
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>
4 years agoui-snapshot: add support for zstd compression
Christian Hesse [Wed, 26 Feb 2020 08:12:21 +0000 (09:12 +0100)]
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>
4 years agotests: add tests for xz compressed snapshots
Christian Hesse [Wed, 26 Feb 2020 08:19:00 +0000 (09:19 +0100)]
tests: add tests for xz compressed snapshots

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years agoui-snapshot: add support for lzip compression
Hanspeter Portner [Fri, 16 Aug 2019 21:40:19 +0000 (23:40 +0200)]
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>
4 years agogit: update to v2.25.1
Christian Hesse [Mon, 17 Feb 2020 08:08:02 +0000 (09:08 +0100)]
git: update to v2.25.1

Update to git version v2.25.1.

No changes required.

4 years agotests: allow to skip git version tests
Christian Hesse [Mon, 13 Jan 2020 20:04:46 +0000 (21:04 +0100)]
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>
4 years agoBump version v1.2.2
Jason A. Donenfeld [Mon, 13 Jan 2020 20:04:14 +0000 (15:04 -0500)]
Bump version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
4 years agogit: update to v2.25.0
Christian Hesse [Wed, 25 Dec 2019 23:02:23 +0000 (00:02 +0100)]
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>
4 years agotests: skip tests if strace is not functional
Christian Hesse [Wed, 11 Dec 2019 09:55:24 +0000 (10:55 +0100)]
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>
4 years agogit: update to v2.24.1
Christian Hesse [Tue, 10 Dec 2019 19:40:45 +0000 (20:40 +0100)]
git: update to v2.24.1

Update to git version v2.24.1.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years agoui-repolist: do not return unsigned (negative) value
Christian Hesse [Fri, 22 Nov 2019 10:09:50 +0000 (11:09 +0100)]
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>
4 years agogit: update to v2.24.0 ch/git-2-24-0
Christian Hesse [Wed, 23 Oct 2019 21:21:54 +0000 (23:21 +0200)]
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>
4 years agogit: update to v2.23.0
Christian Hesse [Thu, 13 Jun 2019 19:41:37 +0000 (21:41 +0200)]
git: update to v2.23.0

Update to git version v2.23.0.

No changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years agogit: update to v2.22.0
Christian Hesse [Mon, 13 May 2019 19:41:37 +0000 (21:41 +0200)]
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>
4 years agoui-tree: allow per repository override for enable-blame
Christian Hesse [Tue, 26 Feb 2019 16:08:31 +0000 (17:08 +0100)]
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>
4 years agotests: successfully validate rc versions
Christian Hesse [Tue, 4 Jun 2019 11:49:36 +0000 (13:49 +0200)]
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>
4 years agogit: update to v2.21.0
Christian Hesse [Sun, 24 Feb 2019 20:19:46 +0000 (21:19 +0100)]
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>
4 years agoui-ssdiff: ban strncat()
Christian Hesse [Tue, 12 Feb 2019 20:53:02 +0000 (21:53 +0100)]
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>
4 years agoglobal: make 'char *path' const where possible
Christian Hesse [Wed, 2 Jan 2019 16:25:01 +0000 (17:25 +0100)]
global: make 'char *path' const where possible

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years agoui-shared: restrict to 15 levels
Jason A. Donenfeld [Mon, 20 May 2019 19:45:12 +0000 (21:45 +0200)]
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>
5 years agoui-diff,ui-tag: don't use htmlf with non-formatted strings
Chris Mayo [Thu, 21 Feb 2019 19:57:23 +0000 (19:57 +0000)]
ui-diff,ui-tag: don't use htmlf with non-formatted strings

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
5 years agoui-ssdiff: resolve HTML5 validation errors
Chris Mayo [Thu, 21 Feb 2019 19:56:05 +0000 (19:56 +0000)]
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>
5 years agofilters: migrate from luacrypto to luaossl
Jason A. Donenfeld [Thu, 3 Jan 2019 01:11:14 +0000 (02:11 +0100)]
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>
5 years agoui-shared: fix broken sizeof in title setting and rewrite
Jason A. Donenfeld [Wed, 2 Jan 2019 06:52:12 +0000 (07:52 +0100)]
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>
5 years agogit: update to v2.20.0
Christian Hesse [Tue, 20 Nov 2018 16:31:21 +0000 (17:31 +0100)]
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>
5 years agoui-blame: set repo for sb
Jason A. Donenfeld [Thu, 22 Nov 2018 00:49:55 +0000 (01:49 +0100)]
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>
5 years agoauth-filter: pass url with query string attached
Jason A. Donenfeld [Wed, 21 Nov 2018 02:16:11 +0000 (03:16 +0100)]
auth-filter: pass url with query string attached

Otherwise redirections come out wrong.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agogit: use xz compressed archive for download
Christian Hesse [Tue, 20 Nov 2018 22:55:03 +0000 (23:55 +0100)]
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>
5 years agogit: update to v2.19.1
Christian Hesse [Tue, 28 Aug 2018 16:27:00 +0000 (18:27 +0200)]
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>
5 years agoui-ssdiff: ban strcat()
Christian Hesse [Tue, 28 Aug 2018 16:23:36 +0000 (18:23 +0200)]
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>
5 years agoui-ssdiff: ban strncpy()
Christian Hesse [Tue, 28 Aug 2018 16:22:26 +0000 (18:22 +0200)]
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>
5 years agoui-shared: ban strcat()
Christian Hesse [Tue, 28 Aug 2018 18:33:02 +0000 (20:33 +0200)]
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>
5 years agoui-patch: ban sprintf()
Christian Hesse [Tue, 28 Aug 2018 16:18:37 +0000 (18:18 +0200)]
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>
5 years agoui-log: ban strncpy()
Christian Hesse [Tue, 28 Aug 2018 16:16:11 +0000 (18:16 +0200)]
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>
5 years agoui-log: ban strcpy()
Christian Hesse [Tue, 28 Aug 2018 16:08:33 +0000 (18:08 +0200)]
ui-log: ban strcpy()

Git upstream bans strcpy() with commit:

  automatically ban strcpy()
  c8af66ab8ad7cd78557f0f9f5ef6a52fd46ee6dd

Signed-off-by: Christian Hesse <mail@eworm.de>
5 years agoparsing: ban sprintf()
Christian Hesse [Tue, 28 Aug 2018 16:14:32 +0000 (18:14 +0200)]
parsing: ban sprintf()

Git upstream bans sprintf() with commit:

  banned.h: mark sprintf() as banned
  cc8fdaee1eeaf05d8dd55ff11f111b815f673c58

Signed-off-by: Christian Hesse <mail@eworm.de>
5 years agoparsing: ban strncpy()
Christian Hesse [Tue, 28 Aug 2018 16:11:50 +0000 (18:11 +0200)]
parsing: ban strncpy()

Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>
5 years agofilters: generate anchor links from markdown
Christian Hesse [Fri, 13 Jul 2018 19:44:50 +0000 (21:44 +0200)]
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>
5 years agoBump version. v1.2.1
Jason A. Donenfeld [Fri, 3 Aug 2018 14:26:14 +0000 (16:26 +0200)]
Bump version.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoclone: fix directory traversal
Jason A. Donenfeld [Fri, 3 Aug 2018 13:46:11 +0000 (15:46 +0200)]
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>
5 years agoconfig: record repo.snapshot-prefix in the per-repo config
Konstantin Ryabitsev [Tue, 17 Jul 2018 16:38:22 +0000 (12:38 -0400)]
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>
5 years agoauth-filters: add simple file-based authentication scheme
Jason A. Donenfeld [Sun, 15 Jul 2018 02:45:11 +0000 (04:45 +0200)]
auth-filters: add simple file-based authentication scheme

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoauth-filters: use crypt() in simple-authentication
Jason A. Donenfeld [Sun, 15 Jul 2018 02:18:03 +0000 (04:18 +0200)]
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>
5 years agoauth-filters: generate secret securely
Jason A. Donenfeld [Sun, 15 Jul 2018 01:22:12 +0000 (03:22 +0200)]
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>
5 years agoauth-filters: do not crash on nil username
Jason A. Donenfeld [Sat, 14 Jul 2018 03:10:28 +0000 (05:10 +0200)]
auth-filters: do not crash on nil username

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>