about summary refs log tree commit diff
path: root/ui-shared.h (follow)
Commit message (Collapse)AuthorAge
* auth-filter: pass url with query string attachedJason A. Donenfeld2018-11-25
| | | | | | Otherwise redirections come out wrong. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-shared: pass separator in to cgit_print_snapshot_links()John Keeping2018-06-27
| | | | | | | | | 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>
* ui-shared: rename parameter to cgit_print_snapshot_links()John Keeping2018-06-27
| | | | | | | | 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>
* ui-shared: remove unused parameterJohn Keeping2018-06-27
| | | | | | | | 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>
* Add "snapshot-prefix" repo configurationJohn Keeping2018-06-27
| | | | | | | | | | | | 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>
* 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>
* 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>
* 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>
* 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: 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>
* Fix missing prototype declarationsPeter Colberg2016-01-14
| | | | Signed-off-by: Peter Colberg <peter@colberg.org>
* ui-shared: return value of cgit_hosturl is not constChristian Hesse2015-10-09
| | | | 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: 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>
* cgit.h: move stdbool.h from ui-shared.hJohn Keeping2015-08-13
| | | | | | Follow the Git policy of including system headers in only one place. Signed-off-by: John Keeping <john@keeping.me.uk>
* 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>
* Make root handling sane again.Jason A. Donenfeld2015-03-03
|
* ui-shared: Add current url helper function.Jason A. Donenfeld2015-03-03
|
* 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>
* 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>
* 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>
* 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>
* ui-shared: Drop filepair_cb_raw() and helperLukas Fleischer2013-09-14
| | | | | | | | Remove filepair_cb_raw() and all related functions. These are no longer needed. We now use Git's internal functions for raw diff formatting everywhere. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Extract filepair_cb from ui-patch.cLukas Fleischer2013-08-16
| | | | | | | | | | | Move filepair_cb() from ui-patch.c to ui-shared.c and rename it to filepair_cb_raw(). This callback will be used in ui-diff.c in a follow-up patch. Note that it is not straightforward to extract filepair_cb() from ui-diff.c which is why it is not done here as well. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Convert cgit_print_error to a variadic functionJohn Keeping2013-04-08
| | | | | | | | | This removes many uses of "fmt" which uses a fixed size static pool of fixed size buffers. Instead of relying on these, we now pass around argument lists for as long as possible before using a strbuf to render content of an arbitrary size. Signed-off-by: John Keeping <john@keeping.me.uk>
* Always #include corresponding .h in .c filesJohn Keeping2013-04-08
| | | | | | | | | | | | While doing this, remove declarations from header files where the corresponding definition is declared "static" in order to avoid build errors. Also re-order existing headers in ui-*.c so that the file-specific header always comes immediately after "cgit.h", helping with future consistency. Signed-off-by: John Keeping <john@keeping.me.uk>
* Return const char * in cgit_{httpscheme, hosturl, rooturl}()Lukas Fleischer2013-04-08
| | | | | | | | | | | | The return values of these functions are essentially constant and should never be modified. Note that this will introduce a compiler warning when we try to free the return value of any of these functions. However, given that all of these currently return statically allocated strings in some cases, they need to be refactored before this can be done anyway. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Merge branch 'lh/module-links'Lars Hjemli2012-03-18
|\
| * ui-tree.c: add support for path-selected submodule linksLars Hjemli2011-06-15
| | | | | | | | | | | | | | | | | | | | | | The current 'repo.module-link' option is sufficient when all gitlinks in a repository can be converted to commit links in a uniform way, but not when different submodules/paths needs different settings. This patch adds support for 'repo.module-link.<path>', which will be used for linking to submodules at paths matching one such entry. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Add sort parameter to pager of repo listTobias Grimm2012-01-03
|/ | | | | | When the repolist is paged, the page-links are missing the sort parameter, causing the initial page to be custom sorted, but any clicked page will then be with the default sort order again.
* ui-commit: Preserve path limit in links to commit pageJohan Herland2010-06-19
| | | | | | | | | | | This includes adding a path argument to cgit_commit_link() and updating all its callers. The callers from within the commit page (i.e. the "commit", "unidiff"/"side-by-side diff" and "parent" links) all preserve the path limit of the current commit page. All other callers pass NULL (i.e. no path limit). Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-patch: Apply path limit to generated patchJohan Herland2010-06-19
| | | | | | | | Also indicate in the comment section of the patch that a path limit was applied, too easily see when a generated patch is only partial. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-shared: Teach "breadcrumb" navigation to path limit display beneath tab barJohan Herland2010-06-19
| | | | | | | | | | | | | | | When a path limit is in effect, and displayed directly beneath the tab bar, it should offer breadcrumb navigation (like what the 'tree' page does), to allow changing the path limit easily. Implementing this requires a robust way to link back to the current page with a changed ctx->qry.path, but without losing track of the other query arguments. This is solved by adding the new cgit_self_link() function, which is then invoked repeatedly by the new cgit_print_path_crumbs() function while manipulating ctx->qry.path. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-shared: Improve const-ness in APIJohan Herland2010-06-19
| | | | | | | This is needed to prevent const-related warnings in later patches. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Merge branch 'ro/ssdiff'Lars Hjemli2009-12-08
|\
| * Add possibility to switch between unidiff and side-by-side-diff.Ragnar Ouchterlony2009-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new config option side-by-side-diffs added, defaulting to 0, meaning unidiff. Also a query option (ss) is used toggle this. In the commit page you can switch between the two diff formats by clicking on the link on the "commit"-row, to the right of (patch). In the diff page you can switch by using the link at the start of the page. All commit-links and diff-links will remember the choice. Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Fix repolist search links with virtual rootGeoff Johnstone2009-09-20
|/ | | | | Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* add cgit_httpscheme() -> http:// or https://Diego Ongaro2009-06-11
|
* Merge branch 'lh/stats'Lars Hjemli2009-01-27
|\ | | | | | | | | | | | | | | | | | | Conflicts: cgit.c cgit.css cgit.h ui-tree.c Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * ui-shared: externalize add_hidden_formfields()Lars Hjemli2008-12-07
| | | | | | | | | | | | This function will be reused by ui-stats.c in the next commit. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * ui-shared: add and use cgit_stats_link()Lars Hjemli2008-12-07
| | | | | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>