aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
AgeCommit message (Collapse)AuthorFilesLines
2012-10-16ui-repolist: Rename section-sort to repository-sort.Jason A. Donenfeld1-3/+3
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-10-16repo_config: do not let globals override repo settingsTobias Bieniek1-3/+3
This makes it possible to activate the enable_commit_graph, enable_log_filecount, and enable_log_linecount for individual repositories, even if the global setting is "0" (default). The commit that introduced the broken behavior was e189344, and the commit message of that makes it clear that this wasn't the intended behavior. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-07-12Update copyright headers to have latest dates.Jason A. Donenfeld1-1/+1
2012-07-12ui-repolist: Case insensitive sorting and age sortJason A. Donenfeld1-0/+6
Add two options, one for doing the ordinary name sorts in a case-insensitive manner, and another for choosing to sort repos in each section by age instead of by name.
2012-07-12scan-tree: Support gitweb.category.Jason A. Donenfeld1-0/+1
Use gitweb.category from git config to determine repo's section, if option is enabled.
2012-07-12scan-tree: Support gitweb.description.Jason A. Donenfeld1-0/+3
Use gitweb.description instead of description file to determine description, if option is enabled.
2012-03-18Merge branch 'fh/mimetypes'Lars Hjemli1-0/+2
2012-03-18Merge branch 'jp/defbranch'Lars Hjemli1-1/+14
2012-03-18Merge branch 'lh/module-links'Lars Hjemli1-2/+7
2012-01-03Merge branch 'stable'Lars Hjemli1-0/+1
2012-01-03Fix diff mode switching when side-by-side-diffs=1Tim Chen1-0/+1
When side-by-side-diffs=1 was set in cgitrc, specyfing 'ss=0' in the query- string would not switch to unified diffs. This patch fixes the issue by introducing a separate variable to track the occurrence of "ss" in the querystring.
2011-07-19ui_plain: automatically lookup mimetype when mimetype-file is setFerry Huberts1-0/+2
For sites that do not want to configure mime types by hand but still want the correct mime type for 'plain' blobs, configuring a mime type file is made possible. This is handy since such a file is normally already provided (at least on Linux systems). Also, this reflects the gitweb option '$mimetypes_file' Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-06-21cgit.c: use resolve_ref() to guess_defbranch()Lars Hjemli1-27/+7
The resolve_ref() function handles reading of git- and filesystem symbolic links (including proper whitespace trimming) and packed refs. There's no point in reimplementing this function in cgit. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-06-20Only guess default branch when a repo page is requestedLars Hjemli1-1/+34
There's no need to invoke guess_defbranch() for each repo during scan-path, since repo.defbranch is only used when repo content is being displayed. Also, some users prefer to register their projects manually in cgitrc but they got no benefit from the new repo.defbranch handling. This patch tries to rectify these issues by only invoking guess_defbranch() when needed, regardless of how the repo was registered. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-06-18Merge branch 'stable'Lars Hjemli1-1/+5
2011-06-18cgit.c: improve error message when git repo cannot be accessedLars Hjemli1-1/+5
The current 'Not a git repository' error message is not very helpful, since it doesn't state the cause of the problem. This patch uses errno to provide a hint of the underlying problem. It would have been even better to give the exact cause (e.g. for ENOENT it would be nice to know which file/directory is missing), but that would require reimplementing setup_git_directory_gently() which seems a bit overkill. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-06-15Do not provide a default value for `module-link`Lars Hjemli1-1/+0
The old default value was an abomination which never should have been allowed to see the light of day. This patch removes the default, which is a backwards incompatible change with low probability of causing anyone any real trouble (a repo with submodules, displayed by cgit using the default value of `module-link`, is very unlikely to actually generate working links). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-06-15ui-tree.c: add support for path-selected submodule linksLars Hjemli1-1/+7
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>
2011-06-14cgit.c: add 'clone-url' setting with support for macro expansionLars Hjemli1-0/+2
The current 'clone-prefix' setting has some known issues: * All repos get the same 'clone-prefix' value since the setting is not adopted during repo registration (in cgitrc, or during scan-path traversal), but only when the setting is used. * The generated clone-urls for a repo is a combination of 'clone-prefix', a slash and the repo url. This doesn't work well with e.g. ssh-style urls like 'git@example.org:repo.git', since the inserted slash will make the repo relative to the filesystem root. * If 'remove-suffix' is enabled, the generated clone-urls will not work for cloning (except for http-urls to cgit itself) since they miss the '.git' suffix. The new 'clone-url' setting is designed to avoid the mentioned issues: * Each repo adopts the default 'clone-url' when the repo is defined. This allows different groups of repos to adopt different values. * The clone-urls for a repo is generated by expanding environment variables in a string template without inserting arbitrary characters, hence any kind of clone-url can be generated. * Macro expansion also eases the 'remove-suffix' pain since it's now possible to define e.g. 'clone-url=git://foo.org/$CGIT_REPO_URL.git' for a set of repos. A furter improvement would be to define e.g. $CGIT_REPO_SUFFIX to '.git' for all repos which had their url prettified, or to store the original $CGIT_REPO_URL in e.g. $CGIT_REPO_REAL_URL before suffix removal. Reviewed-by: Ferry Huberts <mailings@hupie.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-06-14cgit.c: always setup cgit repo environment variablesLars Hjemli1-0/+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>
2011-05-23Merge branch 'fh/filter-api'Lars Hjemli1-7/+20
Conflicts: cgit.c
2011-05-23Merge branch 'stable'Lars Hjemli1-1/+4
2011-05-23fix virtual-root if script-name is ""Mark Lodato1-1/+4
In d0cb841 (Avoid trailing slash in virtual-root), virtual-root was set from script-name using trim_end(). However, if script-name was the empty string (""), which happens when cgit is used to serve the root path on a domain (/), trim_end() returns NULL and cgit acts like virtual-root is not available. Now, set virtual-root to "" in this case, which fixes this bug. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-05-14Merge branch 'dm/disable-clone'Lars Hjemli1-1/+11
2011-03-26new_filter: correctly initialise all arguments for a new filterFerry Huberts1-2/+4
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-03-26new_filter: determine extra_args from filter typeFerry Huberts1-7/+20
Currently the number of extra arguments is linked hard to the type of the filter. This is also logical since it would be confusing to have a different number of arguments for the same type of filter depending on the context under which the filter is run (unless ofcourse one the parameters would make the context clear, which is currently not the case). Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-03-05Merge branch 'stable'Lars Hjemli1-2/+3
2011-03-05Avoid trailing slash in virtual-rootLars Hjemli1-2/+3
When setting virtual-root from cgitrc, care is taken to avoid trailing slashes. But when no virtual-root setting is specified, SCRIPT_FILE from the web server is used without similar checks. This patch fixes the inconsistency, which could lead to double-slashes in generated links. Noticed-by: Wouter Van Hemel <wouter@duodecim.org> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-02-19Return 404 on command not foundDan McGee1-1/+3
We were returning 200 before. Even 404 is questionable in all cases, but 200 was totally wrong. Also match the case of all of the "Not found" status messsages. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-02-19Allow disabling of HTTP clone URLsDan McGee1-0/+8
If advertising other URLs to your users, you may not want to make this available through cgit (e.g. if you have the smart HTTP transport set up elsewhere). Allow disabling the three magic commands that simulate the git server, but default it to enabled. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-02-19Merge branch 'br/misc'Lars Hjemli1-2/+6
* br/misc: Use transparent background for the cgit logo ssdiff: anchors for ssdiff implement repo.logo and repo.logo-link
2011-02-19implement repo.logo and repo.logo-linkBernhard Reutner-Fischer1-2/+6
Allow for per repo logo and logo-link; Use global logo and logo-link per default. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-02-19Merge branch 'jh/scan-path'Lars Hjemli1-0/+3
* jh/scan-path: scan_path(): Do not recurse into hidden directories by default scan_path(): Improve handling of inaccessible directories
2011-02-19scan_path(): Do not recurse into hidden directories by defaultJohan Herland1-0/+3
Paths that start with a period ('.') are considered hidden in the Unix world. scan_path() should arguably not recurse into these directories by default. This patch makes it so, and introduces the "scan-hidden-path" config variable for overriding the new default and revert to the old behaviour (scanning _all_ directories, including hidden .directories). Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <larsh@prediktor.no>
2010-11-16ui-log: Implement support for commit graphsJohan Herland1-0/+6
Teach CGit to print an ASCII art commit graph to the left of the commit message, similar to 'git log --graph'. The graph adds extra lines (table rows) to the log when needed to add/remove/shuffle edges in the graph. When 'showmsg' is enabled, the graph is automatically padded to account for the extra lines added by the commit message/notes. This feature is controlled by a new config variable: "enable-commit-graph" (disabled by default), and individual repos can control it by setting "repo.enable-commit-graph". Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-08Add `strict-export` optionFelix Hanley1-0/+2
This option is used to specify a filename which needs to be present in the repositories found during `scan-path` processing. By setting this option to 'git-daemon-export-ok', only repositories explicitly marked for git daemon export will be included in the cgit configuration. Signed-off-by: Felix Hanley <felix@seconddrawer.com.au> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-09-27Use GIT-1.7.3Lars Hjemli1-1/+1
This fixes http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-2542. Noticed-by: Silvio Cesare <silvio.cesare@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-09-19Merge branch 'ml/bugfix'Lars Hjemli1-1/+1
2010-09-19Merge branch 'lh/section-from-path'Lars Hjemli1-0/+2
Conflicts: scan-tree.c
2010-09-04fix errors in printf-style format stringsMark Lodato1-1/+1
There were many places where the arguments to a printf-like function did not match the format string. Mostly, these were a missing 'l' flag, but there were three exceptions: - In ui-stats.c, a size_t argument must be printed. C99 has the "%zu" flag for this purpose, but not all compilers support this. Therefore, we mimic what git does - use a NO_C99_FORMAT Makefile variable. - In ui-stats.c, cgit_print_error() was called with a pointer instead of a character. - In ui-log.c, the "columns" argument was never used. Signed-off-by: Mark Lodato <lodatom@gmail.com>
2010-08-22Add support for 'section-from-path' optionLars Hjemli1-0/+2
This option can be used to autogenerate section names during scan-path processing. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-22Add support for "readme" optionLars Hjemli1-5/+3
The value of this option is used as the default value for repo.readme. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-22Use GIT-1.7.2.2Lars Hjemli1-1/+1
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-20Support refspecs in about-filter.Jason A. Donenfeld1-1/+3
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-04Add support for 'enable-gitweb-owner' optionJason A. Donenfeld1-0/+3
When this option is enabled (which it is by default), cgit will lookup the 'gitweb.owner' setting in each git config file found when processing the 'scan-path' option. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-04Add support for 'remove-suffix' optionJason A. Donenfeld1-0/+3
When this option is enabled, the '.git' suffix of repository directories found while processing the 'scan-path' option will be removed. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-04Add support for 'project-list' optionJason A. Donenfeld1-5/+22
This option specifies the location of a projectlist file as used by gitweb - when 'scan-tree' is later specified, only the projects listed in the projectlist file will be added. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-07-18Merge branch 'jh/ignorews'Lars Hjemli1-0/+2
2010-07-18Merge branch 'lh/macros'Lars Hjemli1-5/+5
2010-07-18Add URL parameter 'ignorews' for optionally ignoring whitespace in diffsJohan Herland1-0/+2
The new ctx.qry.ignorews variable is passed via cgit_diff_files() and cgit_diff_tree() to Git's diff machinery. This is equivalent to passing --ignore-all-space to 'git diff'. Signed-off-by: Johan Herland <johan@herland.net>