about summary refs log tree commit diff stats
path: root/ui-shared.c
Commit message (Collapse)AuthorAge
* 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>
* ui-shared: make cgit_doctype 'static'John Keeping2015-03-09
| | | | | | This is not used outside this file and is not declared. Signed-off-by: John Keeping <john@keeping.me.uk>
* Avoid non-ANSI function declarationsJohn Keeping2015-03-09
| | | | | | | | Sparse says things like: warning: non-ANSI function declaration of function 'calc_ttl' Signed-off-by: John Keeping <john@keeping.me.uk>
* Make root handling sane again.Jason A. Donenfeld2015-03-03
|
* ui-shared: Add current url helper function.Jason A. Donenfeld2015-03-03
|
* ui-shared: keep filter repolist page in paginationJason A. Donenfeld2015-03-03
|
* ui-repolist: use ctx.qry.url instead of rooturl, in case we're filteringJason A. Donenfeld2015-03-03
|
* ui-shared.c: Refactor add_clone_urls()Lukas Fleischer2015-02-05
| | | | | | Make use of strbuf_split_str() and strbuf lists to split clone URLs. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tag: reference with "h" instead of "id"John Keeping2015-01-19
| | | | | | | | | | | | | | | When clicking on "log" from a tag we end up showing the log of whatever branch we used to reach the tag. If the tag doesn't point onto a branch then the tagged commit won't appear in this output. By linking to tags with the head parameter instead of the "id" parameter the log link will show the log of the tag. This is clearly desirable when the tag has been reached from the refs UI and changing the behaviour for tag decorations makes them match branch decorations where log -> decoration -> log shows the log of the decoration. Reported-by: Ferry Huberts <mailings@hupie.com> Signed-off-by: John Keeping <john@keeping.me.uk>
* footer: link back to cgit home pageJason A. Donenfeld2014-12-23
| | | | | The footer has always been overrideable using the footer= in cgitrc, so this won't anger anybody who cares about their footer.
* ui-shared: show absolute time in tooltip for relative datesJohn Keeping2014-12-23
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: add rel-vcs microformat links to HTML headerJohn Keeping2014-12-23
| | | | | | As described at https://joeyh.name/rfc/rel-vcs/. Signed-off-by: John Keeping <john@keeping.me.uk>
* Extract clone URL printing to ui-shared.cJohn Keeping2014-12-23
| | | | | | | | This will allow us to reuse the same logic to add clone URL <link/> elements to the header of all repo-specific pages in order to support the rel-vcs microformat. Signed-off-by: John Keeping <john@keeping.me.uk>
* Change "ss" diff flag to an enumJohn Keeping2014-12-13
| | | | | | | | | | | This will allow us to introduce a new "stat only" diff mode without needing an explosion of mutually incompatible flags. The old "ss" query parameter is still accepted in order to avoid breaking saved links, but we no longer generate any URIs using it; instead the new "dt" (diff type) parameter is used. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove toggle_ssdiff arg to cgit_diff_link()John Keeping2014-12-13
| | | | | | | This argument is never used with a value other than zero, so remove it and simplify the code. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove toggle_ssdiff arg to cgit_commit_link()John Keeping2014-12-13
| | | | | | | This argument is never used with a value other than zero, so remove it and simplify the code. Signed-off-by: John Keeping <john@keeping.me.uk>
* git: update for git 2.0Christian Hesse2014-06-28
| | | | | | | prefixcmp() and suffixcmp() have been remove, functionality is now provided by starts_with() and ends_with(). Retrurn values have been changed, so instead of just renaming we have to fix logic. Everything else looks just fine.
* ui-shared: do not allow negative minutesJason A. Donenfeld2014-01-17
| | | | | | | Do to timestamp differences, sometimes cgit would should "-0 min", which doesn't make any sense. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-shared: move about tab all the way to the leftJason A. Donenfeld2014-01-17
| | | | | | | | There were no objections (at the time of committing this): http://lists.zx2c4.com/pipermail/cgit/2013-May/001393.html http://lists.zx2c4.com/pipermail/cgit/2014-January/001904.html Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Switch to exclusively using global ctxLukas Fleischer2014-01-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_print_http_headers() * cgit_print_docstart() * cgit_print_pageheader() Remove context parameter from all commands Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_get_cmd() * All cgit command functions. * cgit_clone_info() * cgit_clone_objects() * cgit_clone_head() * cgit_print_plain() * cgit_show_stats() In initialization routines, use the global context variable instead of passing a pointer around locally. Remove callback data parameter for cache slots This is no longer needed since the context is always read from the global context variable. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* auth: have cgit calculate login addressJason A. Donenfeld2014-01-16
| | | | | | | This way we're sure to use virtual root, or any other strangeness encountered. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* auth: add basic authentication filter frameworkJason A. Donenfeld2014-01-16
| | | | | | | | | | | | | | | | This leverages the new lua support. See filters/simple-authentication.lua for explaination of how this works. There is also additional documentation in cgitrc.5.txt. Though this is a cookie-based approach, cgit's caching mechanism is preserved for authenticated pages. Very plugable and extendable depending on user needs. The sample script uses an HMAC-SHA1 based cookie to store the currently logged in user, with an expiration date. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-shared: URL-escape script_nameJohn Keeping2014-01-12
| | | | | | | | As far as I know, there is no requirement that $SCRIPT_NAME contain only URL-safe characters, so we need to make sure that any special characters are escaped. Signed-off-by: John Keeping <john@keeping.me.uk>