aboutsummaryrefslogtreecommitdiffstats
path: root/ui-repolist.c
Commit message (Collapse)AuthorAgeFilesLines
* ui-repolist.c: fallback to "master" if no default branch is specifiedLars Hjemli2011-07-191-1/+2
| | | | | | | | When looking for the modtime of a repo we used to rely on repo.defbranch having a value. This is no longer true so this patch provides a default value when needed. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* cgit.c: always setup cgit repo environment variablesLars Hjemli2011-06-131-1/+1
| | | | | | | | | | | | When cgit learned to setup environment variables for certain repo settings before invoking a filter process, the setup occurred inside cgit_open_filter(). This patch moves the setup out of cgit_open_filter() and into prepare_repo_cmd() to prepare for additional uses of these variables. Reviewed-by: Ferry Huberts <mailings@hupie.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui_repolist: get modtime from packed-refs as fallbackFerry Huberts2011-05-301-3/+12
| | | | | | | | | | | When no modtime could be determined then as a final fallback try to get it from the packed-refs. This will show an idle time when a repository has been packed with all refs in the packed-refs. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Merge branch 'fh/filter-api'Lars Hjemli2011-05-231-1/+1
|\ | | | | | | | | Conflicts: cgit.c
| * cgit_open_filter: also take the repo as a parameterFerry Huberts2011-03-261-1/+1
| | | | | | | | | | | | | | | | To prepare for handing repo configuration to the filter script that is executed. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | ui-repolist.c: do not return random/stale data from read_agefileLars Hjemli2011-05-231-1/+1
|/ | | | | | | | | | | When git/date.c:parse_date() cannot parse its input it returns -1. But read_agefile() checks if the result is different from zero, essentialy returning random data from the date buffer when parsing fails. This patch fixes the issue by verifying that the result from parse_date() is positive. Noticed-by: Julius Plenz <plenz@cis.fu-berlin.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-repolist: fix redefinition of _XOPEN_SOURCEMark Lodato2010-09-041-6/+0
| | | | | | | | | | | | Previously, ui-repolist.c set _GNU_SOURCE and then included a standard library before including <git-compat-util.h>. This was a problem, because <git-compat-util.h> redefined _XOPEN_SOURCE, which is set automatically by glibc when _GNU_SOURCE is set. However, <git-compat-util.h> already sets _GNU_SOURCE and includes both <string.h> and <time.h>, so there is no need to define _GNU_SOURCE or include either header within ui-repolist.c. Signed-off-by: Mark Lodato <lodatom@gmail.com>
* Fix repolist search links with virtual rootGeoff Johnstone2009-09-201-1/+1
| | | | | Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-repolist: handle empty sections similar to NULL sectionsLars Hjemli2009-08-241-7/+11
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-repolist.c: sort by section name, repo name as defaultLars Hjemli2009-08-241-0/+15
| | | | | | | | When no sorting is requested by the client, cgit will now sort by section name followed by repo name. This allows repos to be registered/ discovered independently of their display order. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Introduce 'section' as canonical spelling for 'repo.group'Lars Hjemli2009-08-241-9/+9
| | | | | | | | The 'repo.' prefix should be reserved for repo-specific options, but the option 'repo.group' must still be honored to stay backwards compatible. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add and use a common readfile() functionLars Hjemli2009-08-181-9/+10
| | | | | | | | | | | | This function is used to read the full content of a textfile into a newly allocated buffer (with zerotermination). It replaces the earlier readfile() in scan-tree.c (which was rather error-prone[1]), and is reused by read_agefile() in ui-repolist.c. 1: No checks for EINTR and EAGAIN, fixed-size buffer Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Merge branch 'stable'Lars Hjemli2009-08-181-0/+1
|\
| * truncate buffer before reading empty filesSimon Arlott2009-08-181-0/+1
| | | | | | | | | | | | | | | | | | | | If readfile() reads an empty file, fgets() won't truncate the buffer and it'll still contain the contents of the previously read file. [lh: fixed similar issue in ui-repolist.c] Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Add 'about-filter' and 'repo.about-filter' optionsLars Hjemli2009-08-091-2/+7
|/ | | | | | | | These options can be used to execute a filter command on each about-page, both top-level and for each repository (repo.about-filter can be used to override the current about-filter). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Merge branch 'full-log'Lars Hjemli2008-12-061-1/+1
|\ | | | | | | | | | | Conflicts: cgit.c cgit.h
| * ui-log: add support for showing the full commit messageLars Hjemli2008-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some users prefer to see the full message, so to make these users happy the new querystring parameter "showmsg" can be used to print the full commit message per log entry. A link is provided in the log heading to make this function accessible, and all links and forms tries to preserve the users preference. Note: the new link is not displayed on the summary page since the point of the summary page is to be a summary, but it is still obeyed if specified manually. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Merge branch 'lh/sort-repolist'Lars Hjemli2008-12-061-14/+121
|\ \
| * | ui-repolist: implement lazy caching of repo->mtimeLars Hjemli2008-11-291-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sorting the list of repositories by their last modification time, cgit would (in the worst case) invoke fstat(3) four times and open(3) twice for each callback from qsort(3). This obviously scales very badly. Now, the calculated modtime for each repo is saved in repo->mtime, thus keeping the number of stat/open invocations identical for sorted and unsorted repo-listings. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * | ui-repolist: sort null values lastLars Hjemli2008-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | | When sorting on e.g. owner, it's not interesting to get all repos without owner at the top of the list. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * | ui-repolist: add support for sorting any columnLars Hjemli2008-11-291-9/+83
| | | | | | | | | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * | ui-repolist: extract get_repo_modtime() from print_modtime()Lars Hjemli2008-11-291-27/+19
| | | | | | | | | | | | | | | | | | | | | The new function is then used by both print_modtime() and cgit_reposort_modtime(). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * | Add support for sorting by Age in the repolistBenjamin Close2008-11-291-3/+36
| |/ | | | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* / ui-repolist: avoid build warning for strcasestr(3)Lars Hjemli2008-12-051-0/+4
|/ | | | | | | The non-standard function strcasestr is only defined if _GNU_SOURCE has also been defined. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-repolist: handle empty agefilesLars Hjemli2008-11-141-1/+2
| | | | | | | When the agefile was empty the old code would happily reuse the static buffer filled by a previous call to read_agefile(). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-repolist + ui-shared: Use cgit_summary_link()Lars Hjemli2008-10-051-6/+2
| | | | | | | This makes is possible to use cgit with repository urls containing special url characters like '#' and '?'. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-repolist: enable filtering of repos by pathLars Hjemli2008-09-151-1/+10
| | | | | | | If a repo url is specified but no exact match is found in the list of repos the url will now be used as a prefix-filter. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add a pager on the repolistLars Hjemli2008-05-031-1/+18
| | | | | | | | This enables a pager on the repolist which restricts the number of entries displayed per page, controlled by the new option `max-repo-count` (default value 50). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Prepare for 'about site' page / add 'root-readme' option to cgitrcLars Hjemli2008-04-291-0/+6
| | | | | | | The new option names a file which will be included on a new page, next to the current 'index' page. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Move included header-file out of repolist tableLars Hjemli2008-04-291-6/+3
| | | | | | | | | When the 'index-header' option is specified in cgitrc we used to print the included file content inside the repolist table, which is bad style. This commit makes the included file be printed before the table. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Make a few more columns in repolist and log view clickableLars Hjemli2008-04-141-0/+2
| | | | | | Less mouse movement is nice. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Make repository search case insensitiveLars Hjemli2008-04-131-4/+4
| | | | | | | This reuses the strcasestr() compiled or linked by libgit.a to implement a case insensitive variation of the repository search. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Implement minimal freetext search in the repolistLars Hjemli2008-04-131-12/+37
| | | | | | | This makes the repolist much more usable when there's a lot of repositories registered in cgitrc. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* More layout fixesLars Hjemli2008-04-131-1/+1
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add ui-shared.hLars Hjemli2008-03-241-0/+1
| | | | | | | This is finally a proper headerfile for the shared ui-functions which used to reside in cgit.h Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Remove obsolete cacheitem parameter to ui-functionsLars Hjemli2008-03-241-1/+1
| | | | | | This parameter hasn't been used for a very long time... Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add struct cgit_page to cgit_contextLars Hjemli2008-03-241-2/+4
| | | | | | | | This struct is used when generating http headers, and as such is another small step towards the goal of the whole cleanup series; to invoke each page/view function with a function pointer. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Introduce html.hLars Hjemli2008-03-181-1/+2
| | | | | | | | All html-functions can be quite easily separated from the rest of cgit, so lets do it; the only issue was html_filemode which uses some git-defined macros so the function is moved into ui-shared.c::cgit_print_filemode(). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Move cgit_repo into cgit_contextLars Hjemli2008-02-161-15/+15
| | | | | | | | This removes the global variable which is used to keep track of the currently selected repository, and adds a new variable in the cgit_context structure. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add all config variables into struct cgit_contextLars Hjemli2008-02-161-9/+9
| | | | | | | | This removes another big set of global variables, and introduces the cgit_prepare_context() function which populates a context-variable with compile-time default values. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Fix html error detected by test-suiteLars Hjemli2007-11-111-1/+1
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add search parameters to cgit_log_linkLars Hjemli2007-11-031-1/+2
| | | | | | This makes the [prev] and [next] links work correctly on search results. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add ofs argument to cgit_log_link and use it in ui-log.cLars Hjemli2007-06-291-1/+1
| | | | | | | This fixes a bug in the prev/next links on the log page: when on the default branch the links to prev/next page would contain h=(null). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add setting to enable/disable extra links on index pageLars Hjemli2007-06-191-12/+23
| | | | | | | | | | The summary/log/tree links displayed for each repository on the index page lost some of their purpose when the header menu was added, so this commit introduces the parameter 'enable-index-links' which must be set to 1 to enable these links. Suggested-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Change S/L/T to summary/log/treeLars Hjemli2007-06-181-4/+4
| | | | | | | | In yet another attempt at better usability, the cryptic S/L/T links are changed to show their full name. Suggested-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Change "files" to "tree"Lars Hjemli2007-06-181-1/+1
| | | | | | | | This renames the menu link and the shortcut on the repo index page from the strange "files" to the more gittish "tree". Suggested-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add git_log_link() and fix bug in generic repolink functionLars Hjemli2007-06-171-3/+1
| | | | | | | | | | | The generic repolink function compared head with cgit_query_head, which almost always would be the same pointer. The test now compares with repo.defbranch, which is the wanted behavour. Bug discovered while adding cgit_log_link(), so this commit also contain that change. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add and use cgit_tree_link()Lars Hjemli2007-06-171-19/+16
| | | | | | | This creates a new function used to generate links to 'tree' page and uses the function everywhere a link to the 'tree' page is generated. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Remove unused variable from ui-repolist.c:read_agefile()Lars Hjemli2007-05-231-1/+0
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Show time since last change on index pageLars Hjemli2007-05-221-1/+39
| | | | | | | | | | | | | | | | | | | | When creating the index page, an optional file can be scanned per repository to obtain a timestamp for last modification within the repo. If such a file cannot be found, st_mtime for repo.defbranch is used instead. This information is then printed in a new column, "Idle", using the new function cgit_print_age(). The new parameter "repo.agefile" can be used to specify (globally) a relative path to scan (default value is "info/web/last-modified"). The content of the "last-modified" file can be generated by the post-receive hook with a command like this: git-for-each-ref --format="%(committerdate)" --sort=-committerdate \ --count=1 > $GIT_DIR/info/web/last-modified Signed-off-by: Lars Hjemli <hjemli@gmail.com>