aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2023-01-10config: make empty js= omit script tagHEADmasterSamuel Lidén Borell1-0/+8
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>
2022-12-19js: add dynamic age updateAndy Green3-1/+63
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-19config: add jsAndy Green6-0/+33
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-19css: change to be a listAndy Green4-7/+22
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-19cgitrc: handle value "0" for max-repo-countChristian Hesse2-3/+6
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-19cache: tolerate short writes in print_slotHristo Venev1-20/+25
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-19global: use release_commit_memory()John Keeping3-8/+4
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-19css: reset font size for blame oidJohn Keeping1-0/+4
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-19ui-blame: add a link to the parent commit in blameJohn Keeping1-0/+9
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-19about: allow to give head from queryChristian Hesse2-8/+10
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-19html: fix handling of null bytePeter Prohaska1-1/+1
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-19ui-atom: generate valid Atom feedsJune McEnroe1-11/+20
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-19ui-shared: use owner-filter for repo page headersJune McEnroe1-1/+7
Previously it was only used if owners were displayed on the index. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-12-19ui-commit: use git raw note formatChris Mayo1-1/+1
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-19ui-repolist,ui-shared: remove redundant title on repo anchorsChris Mayo2-2/+2
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-19ui-commit: show subject in commit page titleJune McEnroe1-0/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-12-19ui-tree: show symlink targets in tree listingJune McEnroe1-2/+20
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-19ui-tree,ui-blame: bail from blame if blob is binaryJune McEnroe3-2/+9
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-19git: update to v2.39.0Christian Hesse2-1/+1
Update to git version v2.39.0, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.38.2Christian Hesse2-1/+1
Update to git version v2.38.2, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.38.1Christian Hesse2-1/+1
Update to git version v2.38.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.38.0Christian Hesse2-1/+1
Update to git version v2.38.0, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.37.3Christian Hesse2-1/+1
Update to git version v2.37.3, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.37.2Christian Hesse2-1/+1
Update to git version v2.37.2, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.37.1Christian Hesse2-1/+1
Update to git version v2.37.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.37.0Christian Hesse2-1/+1
Update to git version v2.37.0, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19git: update to v2.36.1Christian Hesse2-1/+1
Update to git version v2.36.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-12-19shared: fix bad free in cgit_diff_treeJune McEnroe1-7/+5
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-04-18git: update to v2.36.0Christian Hesse3-2/+2
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-18git: update to v2.35.3Christian Hesse2-1/+1
Update to git version v2.35.3, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-04-12git: update to v2.35.2Christian Hesse2-1/+1
Update to git version v2.35.2, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-01-29git: update to v2.35.1Christian Hesse2-1/+1
Update to git version v2.35.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2022-01-24git: update to v2.35.0Christian Hesse2-1/+1
Update to git version v2.35.0, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2021-11-24git: update to v2.34.1Christian Hesse2-1/+1
Update to git version v2.34.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2021-11-15git: update to v2.34.0Christian Hesse3-2/+2
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>
2021-11-03git: update to v2.33.0Christian Hesse2-1/+1
Update to git version v2.33.0, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2021-06-08git: update to v2.32.0Christian Hesse6-36/+23
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>
2021-05-18git: update to v2.31.1Christian Hesse2-1/+1
Update to git version v2.31.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2021-05-12md2html: use proper formatting for hrChristian Hesse1-5/+1
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>
2021-03-16git: update to v2.31.0Christian Hesse3-4/+5
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>
2021-02-10git: update to v2.30.1Christian Hesse2-1/+1
Update to git version v2.30.1, no additional changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-12-29tests: t0107: support older and/or non-GNU tarTodd Zullinger1-4/+4
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>
2020-12-29md2html: use sane_lists extensionJason A. Donenfeld1-0/+1
This allows for cleaner nesting semantics and matches github more closely. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-12-29git: update to v2.30.0Christian Hesse6-33/+35
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>
2020-10-30git: update to v2.29.2Christian Hesse2-1/+1
Update to git version v2.29.2. No changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-10-27git: update to v2.29.1Christian Hesse2-1/+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>
2020-10-22tests: try with commit-graphChristian Hesse1-4/+8
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>
2020-10-22tests: do not copy snapshots to /tmp/Christian Hesse1-6/+3
No idea why this was added... Possibly to inspect the snapshot manually? Let's drop it. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-10-20global: replace hard coded hash lengthChristian Hesse4-6/+5
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>
2020-10-20global: replace references to 'sha1' with 'oid'Christian Hesse13-66/+66
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>
2020-10-19git: update to v2.29.0Christian Hesse7-35/+35
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>
2020-07-27git: update to v2.28.0Christian Hesse2-1/+1
Update to git version v2.28.0. No changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-06-02git: update to v2.27.0Christian Hesse2-1/+1
Update to git version v2.27.0. No changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-03-23git: update to v2.26.0Christian Hesse2-1/+1
Update to git version v2.26.0. No changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-03-13Bump versionv1.2.3Jason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-03-13global: use proper accessors for maybe_treeJason A. Donenfeld7-19/+29
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>
2020-03-12ui-snapshot: add support for zstd compressionChristian Hesse4-4/+56
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>
2020-03-12tests: add tests for xz compressed snapshotsChristian Hesse2-1/+43
Signed-off-by: Christian Hesse <mail@eworm.de>
2020-02-26ui-snapshot: add support for lzip compressionHanspeter Portner4-3/+52
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>
2020-02-17git: update to v2.25.1Christian Hesse2-1/+1
Update to git version v2.25.1. No changes required.
2020-01-13tests: allow to skip git version testsChristian Hesse1-0/+4
This allows to run tests non-tagged git checkout or when bisecting. Signed-off-by: Christian Hesse <mail@eworm.de>
2020-01-13Bump versionv1.2.2Jason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-01-13git: update to v2.25.0Christian Hesse3-2/+2
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>
2019-12-11tests: skip tests if strace is not functionalChristian Hesse1-0/+6
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>
2019-12-10git: update to v2.24.1Christian Hesse2-1/+1
Update to git version v2.24.1. No changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2019-11-22ui-repolist: do not return unsigned (negative) valueChristian Hesse1-1/+1
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>
2019-11-08git: update to v2.24.0Christian Hesse3-2/+2
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>
2019-10-25git: update to v2.23.0Christian Hesse2-1/+1
Update to git version v2.23.0. No changes required. Signed-off-by: Christian Hesse <mail@eworm.de>
2019-10-25git: update to v2.22.0Christian Hesse3-7/+12
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>
2019-06-25ui-tree: allow per repository override for enable-blameChristian Hesse6-3/+13
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>
2019-06-05tests: successfully validate rc versionsChristian Hesse1-1/+1
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>
2019-06-05git: update to v2.21.0Christian Hesse9-15/+21
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>
2019-06-05ui-ssdiff: ban strncat()Christian Hesse1-3/+5
Git version v2.21.0 marks strncat() as banned (commit ace5707a803eda0f1dde3d776dc3729d3bc7759a), so replace it. Signed-off-by: Christian Hesse <mail@eworm.de>
2019-06-05global: make 'char *path' const where possibleChristian Hesse9-10/+10
Signed-off-by: Christian Hesse <mail@eworm.de>
2019-05-20ui-shared: restrict to 15 levelsJason A. Donenfeld1-1/+3
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>
2019-02-23ui-diff,ui-tag: don't use htmlf with non-formatted stringsChris Mayo2-3/+3
Signed-off-by: Chris Mayo <aklhfex@gmail.com>
2019-02-23ui-ssdiff: resolve HTML5 validation errorsChris Mayo1-4/+6
- 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>
2019-01-03filters: migrate from luacrypto to luaosslJason A. Donenfeld5-44/+83
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>
2019-01-02ui-shared: fix broken sizeof in title setting and rewriteJason A. Donenfeld1-26/+8
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>
2018-12-09git: update to v2.20.0Christian Hesse4-2/+3
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>
2018-11-25ui-blame: set repo for sbJason A. Donenfeld1-0/+1
Otherwise recent git complains and crashes with: "BUG: blame.c:1787: repo is NULL". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-25auth-filter: pass url with query string attachedJason A. Donenfeld3-3/+37
Otherwise redirections come out wrong. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-21git: use xz compressed archive for downloadChristian Hesse1-2/+2
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>
2018-10-12git: update to v2.19.1Christian Hesse15-22/+23
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>
2018-09-11ui-ssdiff: ban strcat()Christian Hesse1-2/+4
Git upstream bans strcat() with commit: banned.h: mark strcat() as banned 1b11b64b815db62f93a04242e4aed5687a448748 Signed-off-by: Christian Hesse <mail@eworm.de>
2018-09-11ui-ssdiff: ban strncpy()Christian Hesse1-2/+1
Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de>
2018-09-11ui-shared: ban strcat()Christian Hesse1-4/+8
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>
2018-09-11ui-patch: ban sprintf()Christian Hesse1-2/+5
Git upstream bans sprintf() with commit: banned.h: mark sprintf() as banned cc8fdaee1eeaf05d8dd55ff11f111b815f673c58 Signed-off-by: Christian Hesse <mail@eworm.de>
2018-09-11ui-log: ban strncpy()Christian Hesse1-1/+1
Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de>
2018-09-11ui-log: ban strcpy()Christian Hesse1-1/+1
Git upstream bans strcpy() with commit: automatically ban strcpy() c8af66ab8ad7cd78557f0f9f5ef6a52fd46ee6dd Signed-off-by: Christian Hesse <mail@eworm.de>
2018-09-11parsing: ban sprintf()Christian Hesse1-1/+1
Git upstream bans sprintf() with commit: banned.h: mark sprintf() as banned cc8fdaee1eeaf05d8dd55ff11f111b815f673c58 Signed-off-by: Christian Hesse <mail@eworm.de>
2018-09-11parsing: ban strncpy()Christian Hesse1-2/+1
Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de>
2018-08-28filters: generate anchor links from markdownChristian Hesse1-2/+15
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>
2018-08-03Bump version.v1.2.1Jason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-08-03clone: fix directory traversalJason A. Donenfeld1-4/+19
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>
2018-08-03config: record repo.snapshot-prefix in the per-repo configKonstantin Ryabitsev1-0/+2
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>
2018-08-03auth-filters: add simple file-based authentication schemeJason A. Donenfeld1-0/+352
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-15auth-filters: use crypt() in simple-authenticationJason A. Donenfeld1-13/+6
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>
2018-07-15auth-filters: generate secret securelyJason A. Donenfeld2-18/+85
This is much better than having the user generate it themselves. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-14auth-filters: do not crash on nil usernameJason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-14auth-filter: do not write more than we've readJason A. Donenfeld1-2/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-14auth-filters: do not use HMAC-SHA1Jason A. Donenfeld2-4/+4
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>
2018-07-13Bump version.v1.2Jason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-10Update COPYINGTodd Zullinger1-20/+19
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>
2018-07-08css: use correct size in annotated decorationJason A. Donenfeld1-0/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-05cgitrc.5: add local tar signature exampleJason A. Donenfeld1-4/+15
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-04Fix gcc 8.1.1 compiler warningsJason A. Donenfeld3-15/+23
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>
2018-07-03cgitrc.5: document new signature notesJason A. Donenfeld1-1/+17
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-07-03snapshot: support tar signature for compressed tarChristian Hesse2-2/+10
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>
2018-07-03extra-head-content: introduce another option for meta tagsJason A. Donenfeld5-0/+12
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>
2018-06-27Use string list strdup_strings for mimetypesJohn Keeping1-2/+2
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>
2018-06-27manpage: fix sorting orderAndy Green1-88/+88
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>
2018-06-27cache: close race window when unlocking slotsJohn Keeping1-23/+14
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>
2018-06-27git: update to v2.18.0Christian Hesse13-70/+71
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>
2018-06-27global: remove functionality we deprecated for cgit v1.0Christian Hesse5-43/+3
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>
2018-06-27snapshot: strip bit from struct cgit_snapshot_formatChristian Hesse5-10/+17
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>
2018-06-27snapshot: support special value 'all' to enable all formatsChristian Hesse2-0/+4
Signed-off-by: Christian Hesse <mail@eworm.de> Reviewed-by: John Keeping <john@keeping.me.uk>
2018-06-27snapshot: support archive signaturesJohn Keeping3-1/+84
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>
2018-06-27ui-refs: use shared function to print tag downloadsJohn Keeping1-26/+1
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>
2018-06-27ui-shared: pass separator in to cgit_print_snapshot_links()John Keeping4-5/+6
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>
2018-06-27ui-shared: use the same snapshot logic as ui-refsJohn Keeping1-1/+7
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>
2018-06-27ui-shared: rename parameter to cgit_print_snapshot_links()John Keeping2-3/+3
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>
2018-06-27ui-shared: remove unused parameterJohn Keeping4-5/+4
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>
2018-06-27ui-refs: remove unnecessary sanity checkJohn Keeping1-3/+0
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>
2018-06-27ui-snapshot: filter permitted snapshot requestsJohn Keeping1-1/+1
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>
2018-06-27Add "snapshot-prefix" repo configurationJohn Keeping7-4/+23
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>
2018-06-27ui-snapshot: pass repo into get_ref_from_filename()John Keeping1-3/+4
Prepare to allow a custom snapshot prefix. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
2018-06-27ui-shared: pass repo object to print_snapshot_links()John Keeping4-10/+8
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>
2018-06-27ui-log: highlight annotated tags in different colorChristian Hesse2-1/+13
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>
2018-06-27print git version string in footerChristian Hesse1-2/+3
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>
2018-06-27git: update to v2.17.1Christian Hesse3-2/+2
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>
2018-06-19ui-blame: free read_sha1_file() buffer after useAndy Green1-1/+4
Signed-off-by: Andy Green <andy@warmcat.com> Signed-off-by: John Keeping <john@keeping.me.uk>
2018-06-16ui-tag: Fix inconsistent capitalizationJon DeVree1-1/+1
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>
2018-06-16ui-tree: free read_sha1_file() buffer after useAndy Green1-0/+2
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>
2018-06-16Makefile: drive asciidoc directly for HTML outputJohn Keeping2-4/+8
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>
2018-02-21doc: use consistent id's when generating html filesTodd Zullinger1-1/+1
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>
2018-02-12cgit: prepare repo before error pagesJason A. Donenfeld1-7/+12
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>
2018-01-19ui-blame: Allow syntax highlightingJeff Smith3-13/+62
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>
2018-01-19ui-blame: Make each column into a single table cellJeff Smith2-23/+54
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
2018-01-19ui-blame: Break out emit_blame_entry into component methodsJeff Smith1-14/+30
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
2018-01-19ui-blame: Distinguish hashes column from lines columnJeff Smith2-1/+2
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
2018-01-19git: update to v2.16.0Christian Hesse8-10/+9
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>
2017-12-06git: update to v2.15.1Christian Hesse3-1/+2
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>
2017-10-15global: spelling fixesVille Skyttä4-8/+8
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2017-10-15ui-shared: use type='search' for the search boxVille Skyttä1-2/+2
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2017-10-14filter: pipe_fh should be localJason A. Donenfeld2-7/+7
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-10-14parsing: don't clear existing state with empty inputJohn Keeping1-2/+1
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>
2017-10-03ui-tree: link to blame UI if enabledJeff Smith3-4/+29
Create links to the blame page. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
2017-10-03ui-blame: add blame UIJeff Smith8-1/+265
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>
2017-10-03ui-shared: make a char* parameter constJeff Smith2-12/+9
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>
2017-10-03ui-tree: move set_title_from_path to ui-sharedJeff Smith3-33/+35
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>
2017-10-03html: html_ntxt with no ellipsisJeff Smith3-23/+14
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>
2017-10-03cache: flush stdio before restoring FDsJohn Keeping2-2/+6
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>
2017-09-22Use https for submoduleDaniel M. Weeks1-1/+1
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>
2017-08-10ui-plain: print symlink contentJohn Keeping1-1/+1
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>
2017-08-10cgit: don't set vpath unless repo is setJohn Keeping1-6/+6
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>
2017-08-10parsing: clear query path before startingJohn Keeping1-1/+1
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>
2017-08-10ui-shared: don't print path crumbs without a repoJohn Keeping1-1/+1
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>
2017-08-10ui-atom: properly escape delimiter in page linkJohn Keeping1-1/+1
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>
2017-08-10git: update to v2.14Jeff Smith14-42/+43
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>
2017-08-10git: update to v2.13.4Christian Hesse4-5/+10
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.
2017-07-27Update .mailmap with my new email addressLukas Fleischer1-2/+2
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
2017-04-05Remove unused variable from sort_section()Lukas Fleischer1-1/+0
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
2017-03-30ui-repolist: properly sort by ageJason A. Donenfeld1-21/+17
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>
2017-01-23ui-patch: fix crash when using path limitLukas Fleischer1-4/+3
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>
2017-01-22syntax-highlighting: replace invalid unicode with ?Jason A. Donenfeld1-2/+2
2016-11-30git: update to v2.11.0Christian Hesse3-2/+2
Update to git version v2.11.0. Function write_archive() dropped argument (int setup_prefix).
2016-11-25Link with -ldl on GNU HurdPeter Colberg1-1/+1
Debian GNU/Hurd uses the GNU C library. Signed-off-by: Peter Colberg <peter@colberg.org>
2016-11-24git: update to v2.10.2 againJohn Keeping1-0/+0
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>
2016-11-23Bump version.v1.1Jason A. Donenfeld2-1/+1
2016-11-23css: highlight even table rows and skip empty rowsChristian Hesse3-3/+24
This is stolen from kernel.org css [0]. [0] https://git.kernel.org/cgit-korg-0.10.1.css
2016-11-06git: update to v2.10.2Christian Hesse2-1/+1
Update to git version v2.10.2, no changes required.
2016-10-12ui-blog: fix oid handlingChristian Hesse1-5/+5
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').
2016-10-12shared: remove unused function strlpart()Christian Hesse2-17/+0
2016-10-12shared: remove unused function strrpart()Christian Hesse2-16/+0
2016-10-12ui-repolist: fix memory leakChristian Hesse1-1/+3
2016-10-12Use skip_prefix() to get rid of magic constantsLukas Fleischer2-28/+34
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
2016-10-12patch: reapply path limitJohn Keeping1-2/+8
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>
2016-10-07ui-repolist: fix memory leakChristian Hesse1-1/+4
2016-10-04git: update to v2.10.1Christian Hesse2-1/+1
Update to git version v2.10.1, no changes required.
2016-10-04ui-tree: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-3/+3
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...
2016-10-04ui-tag: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-6/+6
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...
2016-10-04ui-snapshot: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-9/+9
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...
2016-10-04ui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-5/+5
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...
2016-10-04ui-plain: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-3/+3
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...
2016-10-04ui-patch: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-11/+11
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...
2016-10-04ui-log: replace get_sha1() with get_oid()Christian Hesse1-1/+1
Data structures have been replaced already, so use correct function calls.
2016-10-04ui-commit: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-4/+4
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...
2016-10-04ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-22/+22
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().
2016-10-04cgit: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-4/+5
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...
2016-10-01Makefile: remove extra spaceJason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2016-10-01Simplify http_parse_querystring()Lukas Fleischer2-57/+11
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>
2016-10-01ui-tree: remove a fixed size bufferJohn Keeping1-6/+9
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>
2016-10-01ui-tag: clean up taginfoJohn Keeping1-2/+4
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>
2016-10-01shared: make cgit_free_taginfo() publicJohn Keeping2-1/+2
We will use this function from ui-tag.c in the next patch. Signed-off-by: John Keeping <john@keeping.me.uk>
2016-10-01shared: remove return value from cgit_free_commitinfo()John Keeping2-3/+2
This return value is never used and the function always returns NULL. Signed-off-by: John Keeping <john@keeping.me.uk>
2016-10-01tree: allow skipping through single-child treesJohn Keeping1-2/+68
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>
2016-10-01ui-ssdiff: fix decl-after-statement warningsJohn Keeping1-2/+2
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>
2016-10-01ui-shared: fix decl-after-statement warningsJohn Keeping1-5/+7
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>
2016-10-01configfile: fix EOF handlingJohn Keeping1-1/+3
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>