aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Mark several functions/variables staticLukas Fleischer2013-03-041-13/+13
| | | | | | Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* cgit.c: Remove parameter from guess_defbranch()Lukas Fleischer2013-03-041-2/+2
| | | | | | We use resolve_ref() since commit 8d7c2ec2, so this is no longer needed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* White space around control verbs.Jason A. Donenfeld2013-03-041-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Fix several whitespace errorsLukas Fleischer2013-03-041-9/+9
| | | | | | | | | | * Remove whitespace at the end of lines. * Replace space indentation by tabs. * Add whitespace before/after several operators ("+", "-", "*", ...) * Add whitespace to assignments ("foo = bar;"). * Fix whitespace in parameter lists ("foobar(foo, bar, 42)"). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Update git to v1.7.9.7John Keeping2013-03-021-1/+1
| | | | | | resolve_ref() is renamed to resolve_ref_unsafe(). CGit's usage is safe. Signed-off-by: John Keeping <john@keeping.me.uk>
* Make "owner" column on index page configurableFlorian Pritz2013-02-011-0/+3
| | | | | | | | | This is not really needed for personal sites where all repos belong to the same person. Since it is pretty useful for shared sites however, it should be configurable. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-log: Add "commit-sort" option for controlling commit orderingTobias Bieniek2012-10-171-2/+12
| | | | | | | This makes it possible to use strict commit date ordering or strict topological ordering by passing the corresponding flags to "git log". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-repolist: Add "section-sort" flag to control section sorting.Tobias Bieniek2012-10-171-0/+3
| | | | | | | | Flag which, when set to "1", will sort the sections on the repository listing by name. Set this flag to "0" if the order in the cgitrc file should be preserved. Default value: "1". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* scan-tree: Unify gitweb.* and cgit.* settings into one config option.Jason A. Donenfeld2012-10-171-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | After some back and forth with Jamie and René, it looks like the git config semantics are going to be like this: - gitweb.category maps to the cgit repo config key "section" - gitweb.description maps to the cgit repo config key "desc" - gitweb.owner maps to the cgit repo config key "owner" - cgit.* maps to all cgit repo config keys This option can be enabled with "enable-git-config=1", and replaces all previous "enable-gitweb-*" config keys. The order of operations is as follows: - git config settings are applied in the order that they exist in the git config file - if the owner is not set from git config, get the owner using the usual getpwuid call - if the description is not set from git config, look inside the static $path/description file - if section-from-path=1, override whatever previous settings were inside of git config using the section-from-path logic - parse $path/cgitrc for local repo.* settings, that override all previous settings
* ui-repolist: Rename section-sort to repository-sort.Jason A. Donenfeld2012-10-161-3/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* repo_config: do not let globals override repo settingsTobias Bieniek2012-10-161-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>
* Update copyright headers to have latest dates.Jason A. Donenfeld2012-07-121-1/+1
|
* ui-repolist: Case insensitive sorting and age sortJason A. Donenfeld2012-07-121-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.
* scan-tree: Support gitweb.category.Jason A. Donenfeld2012-07-121-0/+1
| | | | | Use gitweb.category from git config to determine repo's section, if option is enabled.
* scan-tree: Support gitweb.description.Jason A. Donenfeld2012-07-121-0/+3
| | | | | Use gitweb.description instead of description file to determine description, if option is enabled.
* Merge branch 'fh/mimetypes'Lars Hjemli2012-03-181-0/+2
|\
| * ui_plain: automatically lookup mimetype when mimetype-file is setFerry Huberts2011-07-191-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>
* | Merge branch 'jp/defbranch'Lars Hjemli2012-03-181-1/+14
|\ \
| * | cgit.c: use resolve_ref() to guess_defbranch()Lars Hjemli2011-06-201-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>
| * | Only guess default branch when a repo page is requestedLars Hjemli2011-06-201-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>
* | Merge branch 'lh/module-links'Lars Hjemli2012-03-181-2/+7
|\ \
| * | Do not provide a default value for `module-link`Lars Hjemli2011-06-151-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>
| * | ui-tree.c: add support for path-selected submodule linksLars Hjemli2011-06-151-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>
* | | Merge branch 'stable'Lars Hjemli2012-01-031-0/+1
|\ \ \ | |_|/ |/| |
| * | Fix diff mode switching when side-by-side-diffs=1Tim Chen2012-01-031-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.
* | | Merge branch 'stable'Lars Hjemli2011-06-181-1/+5
|\| | | |/ |/|
| * cgit.c: improve error message when git repo cannot be accessedLars Hjemli2011-06-181-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>
* | cgit.c: add 'clone-url' setting with support for macro expansionLars Hjemli2011-06-131-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>
* | cgit.c: always setup cgit repo environment variablesLars Hjemli2011-06-131-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>
* | Merge branch 'fh/filter-api'Lars Hjemli2011-05-231-7/+20
|\ \ | | | | | | | | | | | | Conflicts: cgit.c
| * | new_filter: determine extra_args from filter typeFerry Huberts2011-03-261-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>
* | | Merge branch 'stable'Lars Hjemli2011-05-231-1/+4
|\ \ \ | | |/ | |/|
| * | fix virtual-root if script-name is ""Mark Lodato2011-05-231-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>
* | | Merge branch 'dm/disable-clone'Lars Hjemli2011-05-141-1/+11
|\ \ \ | |/ / |/| |
| * | Return 404 on command not foundDan McGee2011-02-191-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>
| * | Allow disabling of HTTP clone URLsDan McGee2011-02-191-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>
* | | new_filter: correctly initialise all arguments for a new filterFerry Huberts2011-03-261-2/+4
| |/ |/| | | | | | | Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Merge branch 'stable'Lars Hjemli2011-03-051-2/+3
|\ \
| * | Avoid trailing slash in virtual-rootLars Hjemli2011-03-051-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>
| * | Use GIT-1.7.3Lars Hjemli2010-09-271-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>
* | | Merge branch 'br/misc'Lars Hjemli2011-02-191-2/+6
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * br/misc: Use transparent background for the cgit logo ssdiff: anchors for ssdiff implement repo.logo and repo.logo-link
| * | | implement repo.logo and repo.logo-linkBernhard Reutner-Fischer2011-02-191-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>
* | | Merge branch 'jh/scan-path'Lars Hjemli2011-02-191-0/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | * jh/scan-path: scan_path(): Do not recurse into hidden directories by default scan_path(): Improve handling of inaccessible directories
| * | | scan_path(): Do not recurse into hidden directories by defaultJohan Herland2011-02-191-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>
* / / ui-log: Implement support for commit graphsJohan Herland2010-11-161-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>
* | Add `strict-export` optionFelix Hanley2010-11-081-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>
* | Merge branch 'ml/bugfix'Lars Hjemli2010-09-191-1/+1
|\ \
| * | fix errors in printf-style format stringsMark Lodato2010-09-041-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>
* | | Merge branch 'lh/section-from-path'Lars Hjemli2010-09-191-0/+2
|\ \ \ | | | | | | | | | | | | | | | | Conflicts: scan-tree.c
| * | | Add support for 'section-from-path' optionLars Hjemli2010-08-221-0/+2
| |/ / | | | | | | | | | | | | | | | | | | This option can be used to autogenerate section names during scan-path processing. Signed-off-by: Lars Hjemli <hjemli@gmail.com>