Commit Graph

1630 Commits

Author SHA1 Message Date
Loïc
f450324526 css: highlight line in diff...
... specified in the URL, with a curved arrow ahead of the line number.

Signed-off-by: Loïc <lagiraudiere+cgit@free.fr>
Signed-off-by: Christian Hesse <mail@eworm.de>
2024-08-04 23:37:57 +02:00
Christian Hesse
09d24d7cd0 git: update to v2.46.0
Update to git version v2.46.0, this requires changes for these
upstream commits:

* e7da9385708accf518a80a1e17969020fb361048
  global: introduce `USE_THE_REPOSITORY_VARIABLE` macro

* 9da95bda74cf10e1475384a71fd20914c3b99784
  hash: require hash algorithm in `oidread()` and `oidclr()`

* 30aaff437fddd889ba429b50b96ea4c151c502c5
  refs: pass repo when peeling objects

* c8f815c2083c4b340d4148a15d45c55f2fcc7d3f
  refs: remove functions without ref store

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-08-02 18:22:56 +02:00
Denis Pronin
fb87de795b fix building with clang
fix error that is given because of macro overlapping cgit_filter member:

../filter.c:388:10: error: no member named '__fprintf_chk' in
'struct cgit_filter'
  388 |         filter->fprintf(filter, f, prefix);
      |         ~~~~~~  ^
/usr/include/bits/stdio2.h:92:3: note: expanded from macro 'fprintf'
   92 |   __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
      |   ^
1 error generated.

Signed-off-by: Denis Pronin <dannftk@yandex.ru>
Signed-off-by: Christian Hesse <mail@eworm.de>
2024-07-16 13:26:10 +02:00
Christian Hesse
34c30d12fc ui-stats: add missing source header
Signed-off-by: Christian Hesse <mail@eworm.de>
2024-07-16 12:10:38 +02:00
Christian Hesse
b2c939af4b git: update to v2.45.2
Update to git version v2.45.2, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-06-01 23:29:44 +02:00
Christian Hesse
92a8f1676a git: update to v2.45.1
Update to git version v2.45.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-05-14 19:59:11 +02:00
Christian Hesse
dbadd856ba git: update to v2.45.0
Update to git version v2.45.0, this requires changes for these
upstream commits:

* 9720d23e8caf4adee44b3a32803a9bb0480118bd
  date: make DATE_MODE thread-safe

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-04-29 21:13:53 +02:00
Christian Hesse
8905003cba git: update to v2.44.0
Update to git version v2.44.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-02-23 18:28:47 +01:00
Christian Hesse
63d35e556f git: update to v2.43.2
Update to git version v2.43.2, no additional changes required.

(Git v2.43.1 fails to build, thus skipping.)

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-02-14 20:40:39 +01:00
Christian Hesse
793c420897 git: update to v2.43.0
Update to git version v2.43.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-11-20 20:45:03 +01:00
Christian Hesse
a95762af1a git: update to v2.42.1
Update to git version v2.42.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-11-02 21:26:06 +01:00
Christian Hesse
2f50b47c72 git: update to v2.42.0
Update to git version v2.42.0, this requires changes for these
upstream commits:

* bc5c5ec0446895f5c4139cd470066beb3c4ac6d5
  cache.h: remove this no-longer-used header

* aba070683295a20bdf4f49146384984961c794b2
  path: move related function to path

* a4e7e317f8f27f861321e6eb08b9c8c0f3ab570c
  config: add ctx arg to config_fn_t

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-08-21 20:56:40 +02:00
Christian Hesse
a6da40bf84 git: update to v2.41.0
Update to git version v2.41.0, with lots of changes...
This requires changes for these upstream commits:

* 60ff56f50372c1498718938ef504e744fe011ffb
  banned.h: mark `strtok()` and `strtok_r()` as banned

* 52acddf36c8cb3778ab2098a0d95cc2e375a4069
  string-list: multi-delimiter `string_list_split_in_place()`

* d850b7a545fcfbd97460a921c7f7c59d933eb0f7
  cocci: apply the "cache.h" part of "the_repository.pending"

* cb338c23d6d518947bf6f7240bf30e2ec232bd3b
  cocci: apply the "commit-reach.h" part of "the_repository.pending"

* ecb5091fd4301ac647db0bd2504112b38f7ee06d
  cocci: apply the "commit.h" part of "the_repository.pending"

* 085390328f5fe1dfba67039b1fd6cc51546a4e41
  cocci: apply the "diff.h" part of "the_repository.pending"

* bc726bd075929aab6b3e09d4dd5c2b0726fd5350
  cocci: apply the "object-store.h" part of "the_repository.pending"

* bab821646a74c446370fa8d01ca851f247df5033
  cocci: apply the "pretty.h" part of "the_repository.pending"

* afe27c889429438829bc8818ed17e4960bd3ef02
  cocci: apply the "packfile.h" part of "the_repository.pending"

* 12cb1c10a64170a5d600dd1c6c8abfeec105fb6b
  cocci: apply the "refs.h" part of "the_repository.pending"

* 035c7de9e9ea11d26df5f9e4bb117f91ed11a9fd
  cocci: apply the "revision.h" part of "the_repository.pending"

... and some more I missed to list 😜 - for example the move and cleanup
of headers and includes (see changes in `cgit.h`) comes to mind...

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-06-01 12:00:43 +02:00
Christian Hesse
0e6744b308 git: update to v2.40.1
Update to git version v2.40.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-04-25 19:12:11 +02:00
Christian Hesse
2593cd8138 git: update to v2.40.0
Update to git version v2.40.0, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-03-13 20:38:46 +01:00
Christian Hesse
4dee601bb6 git: update to v2.39.2
Update to git version v2.39.2, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-02-14 20:55:47 +01:00
Christian Hesse
6feb1b669b git: update to v2.39.1
Update to git version v2.39.1, no additional changes required.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-01-18 07:58:23 +01:00
Samuel Lidén Borell
00ecfaadea 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>
2023-01-10 17:52:54 +01:00
Andy Green
907134b7a2 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>
2022-12-19 16:50:23 +01:00
Andy Green
aee39b4e9a 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>
2022-12-19 16:50:21 +01:00
Andy Green
093ac96970 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>
2022-12-19 16:49:09 +01:00
Christian Hesse
91f25909b9 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>
2022-12-19 16:22:26 +01:00
Hristo Venev
852cb3b0e2 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>
2022-12-19 16:13:58 +01:00
John Keeping
4c520cefc9 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>
2022-12-19 16:13:58 +01:00
John Keeping
d071f28cfa 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>
2022-12-19 16:13:58 +01:00
John Keeping
c1a1d23111 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>
2022-12-19 16:13:58 +01:00
Christian Hesse
a0f6669bdb 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>
2022-12-19 16:13:58 +01:00
Peter Prohaska
ce2062d9e2 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>
2022-12-19 16:13:58 +01:00
June McEnroe
4e4b30effb 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>
2022-12-19 16:13:58 +01:00
June McEnroe
3295155a0c 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>
2022-12-19 16:13:24 +01:00
Chris Mayo
e32f8416e8 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>
2022-12-19 16:13:24 +01:00
Chris Mayo
afffc3e772 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>
2022-12-19 16:13:24 +01:00
June McEnroe
fd20a5475e ui-commit: show subject in commit page title
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-12-19 15:24:34 +01:00
June McEnroe
bcffc52366 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>
2022-12-19 15:22:52 +01:00
June McEnroe
cc6d9cc7fc 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>
2022-12-19 15:14:05 +01:00
Christian Hesse
e10159691e 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
979cf4a753 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
6ac984b51d 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
33efb5fec5 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
e5c868f109 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
43df01c10f 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
89ee517122 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
2486d70752 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>
2022-12-19 15:09:39 +01:00
Christian Hesse
bcdfb2197f 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>
2022-12-19 15:09:39 +01:00
June McEnroe
b9ff119549 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>
2022-12-19 15:09:34 +01:00
Christian Hesse
bb02e24ec2 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>
2022-04-18 22:15:36 +02:00
Christian Hesse
cc9b717c87 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>
2022-04-18 22:10:41 +02:00
Christian Hesse
9761994243 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>
2022-04-12 19:01:23 +02:00
Christian Hesse
bbbaa29a96 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>
2022-01-29 10:20:25 +01:00
Christian Hesse
73e98c16e8 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>
2022-01-24 20:45:20 +01:00