about summary refs log tree commit diff
path: root/ui-shared.c (follow)
Commit message (Collapse)AuthorAge
* ui-shared: pass repo object to print_snapshot_links()John Keeping2018-06-27
| | | | | | | | | | 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>
* print git version string in footerChristian Hesse2018-06-27
| | | | | | | | | | | 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>
* git: update to v2.17.1Christian Hesse2018-06-27
| | | | | | | | | 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>
* ui-shared: use type='search' for the search boxVille Skyttä2017-10-15
| | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* ui-tree: link to blame UI if enabledJeff Smith2017-10-03
| | | | | | | Create links to the blame page. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
* ui-shared: make a char* parameter constJeff Smith2017-10-03
| | | | | | | | | | | 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>
* ui-tree: move set_title_from_path to ui-sharedJeff Smith2017-10-03
| | | | | | | | 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>
* ui-shared: don't print path crumbs without a repoJohn Keeping2017-08-10
| | | | | | | | | | | | | | | 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>
* ui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse2016-10-04
| | | | | | 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...
* ui-shared: fix decl-after-statement warningsJohn Keeping2016-10-01
| | | | | | | | 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>
* ui-shared: fix segfault when defbranch is NULLEric Wong2016-07-06
| | | | | | | | Not sure if there's a better fix for this. defbranch is NULL here on my setup when a crawler hit an invalid URL, causing strcmp to segfault. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Avoid ambiguities when prettifying snapshot namesLukas Fleischer2016-07-05
| | | | | | | | | | | When composing snapshot file names for a tag with a prefix of the form v[0-9] (resp. V[0-9]), the leading "v" (resp. "V") is stripped. This leads to conflicts if a tag with the stripped name already exists or if there are tags only differing in the capitalization of the leading "v". Make sure we do not strip the "v" in these cases. Reported-by: Juuso Lapinlampi <wub@partyvan.eu> Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* Hosted on HTTPS nowJason A. Donenfeld2016-06-07
|
* forms: action should not be emptyJason A. Donenfeld2016-05-12
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-shared: Remove a name attribute with an empty valueJuuso Lapinlampi2016-05-12
| | | | | | | | The name attribute is optional in an input element, but it must not be an empty value. See: https://html.spec.whatwg.org/#attr-fe-name See: https://html.spec.whatwg.org/#the-input-element
* ui-shared: HTML-ize DOCTYPE and <html>Juuso Lapinlampi2016-05-12
| | | | | Get rid of the XHTML headers, bringing cgit slowly to the modern age of HTML.
* ui-shared: Simplify cgit_print_error_page() logicJuuso Lapinlampi2016-05-12
|
* ui-shared: redirect should not exit early for cacheJason A. Donenfeld2016-02-26
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tabs: do not use target=_blankJason A. Donenfeld2016-02-23
|
* ui-shared: add homepage to tabsJason A. Donenfeld2016-02-22
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Avoid DATE_STRFTIME for long/short datesJohn Keeping2016-02-08
| | | | | | | | | | | Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove cgit_print_date()John Keeping2016-02-08
| | | | | | There are no longer any users of this function. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: use show_date for footer timestampJohn Keeping2016-02-08
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui: show ages in the originator's timezoneJohn Keeping2016-02-08
| | | | | | | This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: add cgit_date_mode()John Keeping2016-02-08
| | | | | | | | This returns the correct mode value for use with Git's show_date() based on the current CGit configuration and will be used in the following patches. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove "format" from cgit_print_age()John Keeping2016-02-08
| | | | | | | We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: prevent malicious filename from injecting headersJason A. Donenfeld2016-01-14
|
* ui-shared: Avoid new line injection into redirect headerJason A. Donenfeld2016-01-14
|
* Fix segmentation fault in hc()Lukas Fleischer2016-01-13
| | | | | | | | The ctx.qry.page variable might be unset at this point, e.g. when an invalid command is passed and cgit_print_pageheader() is called to show an error message. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* git: update to v2.7.0Christian Hesse2016-01-13
| | | | | | | | | | | | | | Update to git version v2.7.0. * Upstream commit ed1c9977cb1b63e4270ad8bdf967a2d02580aa08 (Remove get_object_hash.) changed API: Convert all instances of get_object_hash to use an appropriate reference to the hash member of the oid member of struct object. This provides no functional change, as it is essentially a macro substitution. Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: fix resource leak: free allocation from cgit_hosturlChristian Hesse2015-10-09
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: return value of cgit_hosturl is not constChristian Hesse2015-10-09
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: fix resource leak: free allocation from cgit_currenturlChristian Hesse2015-10-09
| | | | | Coverity-id: 13927 Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: return value of cgit_currenturl is not constChristian Hesse2015-10-09
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: fix resource leak: free allocation from cgit_fileurlChristian Hesse2015-10-09
| | | | | Coverity-id: 13918 Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: cache errors for "dynamic TTL"John Keeping2015-08-14
| | | | | | | Most errors we generate are (potentially) transient, such as non-existent object IDs so we don't want them to be cached forever. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: add cgit_print_layout_{start,end}()John Keeping2015-08-14
| | | | | | | | These will avoid needing to call three functions to start page layout in subsequent patches when we move the layout setup into each individual page. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: add cgit_print_error_page() functionJohn Keeping2015-08-14
| | | | | | | This will allow us to generate error responses with the correct HTTP response code without needing all of the layout boilerplate. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: show full date in tooltip if longer ago than max_relativeJohn Keeping2015-08-13
| | | | | | | | | | | Commit caed6cb (ui-shared: show absolute time in tooltip for relative dates, 2014-12-20) added a toolip when we show a relative time. However, in some cases we show a short date (that is, the date but not the time) if an event was sufficiently far in the past and that commit did not update that case to add the same tooltip. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: use common function in print_rel_date()John Keeping2015-08-13
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: extract date formatting to a functionJohn Keeping2015-08-13
| | | | | | This will allow this code to be common with print_rel_date. Signed-off-by: John Keeping <john@keeping.me.uk>
* redirect: cleanlinessJason A. Donenfeld2015-08-13
|
* log: allow users to follow a fileJohn Keeping2015-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach the "log" UI to behave in the same way as "git log --follow", when given a suitable instruction by the user. The default behaviour remains to show the log without following renames, but the follow behaviour can be activated by following a link in the page header. Follow is not the default because outputting merges in follow mode is tricky ("git log --follow" will not show merges). We also disable the graph in follow mode because the commit graph is not simplified so we end up with frequent gaps in the graph and many lines that do not connect with any commits we're actually showing. We also teach the "diff" and "commit" UIs to respect the follow flag on URLs, causing the single-file version of these UIs to detect renames. This feature is needed only for commits that rename the path we're interested in. For commits before the file has been renamed (i.e. that appear later in the log list) we change the file path in the links from the log to point to the old name; this means that links to commits always limit by the path known to that commit. If we didn't do this we would need to walk down the log diff'ing every commit whenever we want to show a commit. The drawback is that the "Log" link in the top bar of such a page links to the log limited by the old name, so it will only show pre-rename commits. I consider this a reasonable trade-off since the "Back" button still works and the log matches the path displayed in the top bar. Since following renames requires running diff on every commit we consider, I've added a knob to the configuration file to globally enable/disable this feature. Note that we may consider a large number of commits the revision walking machinery no longer performs any path limitation so we have to examine every commit until we find a page full of commits that affect the target path or something related to it. Suggested-by: René Neumann <necoro@necoro.eu> Signed-off-by: John Keeping <john@keeping.me.uk>
* about: always ensure page has a trailing slashJason A. Donenfeld2015-08-12
| | | | | | Otherwise we can't easily embed links to other /about/ pages. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* git: update to v2.5.0Christian Hesse2015-08-12
| | | | | | | | | | | | | | | Update to git version v2.5.0. * Upstream commit 5455ee0573a22bb793a7083d593ae1ace909cd4c (Merge branch 'bc/object-id') changed API: for_each_ref() callback functions were taught to name the objects not with "unsigned char sha1[20]" but with "struct object_id". * Upstream commit dcf692625ac569fefbe52269061230f4fde10e47 (path.c: make get_pathname() call sites return const char *) Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: allow remote refs in branch switcherChristian Hesse2015-03-18
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* Remove no-op link from submodule entriesLukas Fleischer2015-03-13
| | | | | | | Instead of linking to the current page ("href='#'"), do not add a link to a submodule entry at all if the module-link setting is not used. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-shared: currenturl should take into account leading slashJason A. Donenfeld2015-03-09
|
* ui-shared: don't use an integer as a NULL pointerJohn Keeping2015-03-09
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: avoid initializing static variable to zeroJohn Keeping2015-03-09
| | | | | | | | | Sparse complains that we are using a plain integer as a NULL pointer here, but in fact we do not have to specify a value for this variable at all since it has static storage duration and thus will be initialized to NULL by the compiler. Signed-off-by: John Keeping <john@keeping.me.uk>