Commit Graph

276 Commits

Author SHA1 Message Date
John Keeping
2ab1cd9f3b Update git to v1.7.7.7
This release changes the archive interface so that we now need to pass
argv into write_archive().

Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-02 10:38:03 -05:00
Florian Pritz
b1e172acca Make "owner" column on index page configurable
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>
2013-02-01 12:50:24 +01:00
Tobias Bieniek
792f813d34 ui-log: Add "commit-sort" option for controlling commit ordering
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>
2012-10-17 16:30:29 +02:00
Tobias Bieniek
7a4e7c8ffb ui-repolist: Add "section-sort" flag to control section sorting.
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>
2012-10-17 16:30:22 +02:00
Jason A. Donenfeld
521e10c884 scan-tree: Unify gitweb.* and cgit.* settings into one config option.
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
2012-10-17 16:30:09 +02:00
Jason A. Donenfeld
fdfb6a6d80 ui-repolist: Rename section-sort to repository-sort.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-10-16 23:32:53 +02:00
Jason A. Donenfeld
184c5655b2 ui-repolist: Case insensitive sorting and age sort
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-12 20:01:46 +02:00
Jason A. Donenfeld
fc9181ff3d scan-tree: Support gitweb.category.
Use gitweb.category from git config to determine repo's section, if
option is enabled.
2012-07-12 20:01:46 +02:00
Jason A. Donenfeld
b56be4ba3a scan-tree: Support gitweb.description.
Use gitweb.description instead of description file to determine
description, if option is enabled.
2012-07-12 20:01:46 +02:00
Lars Hjemli
ae90a0b2d1 Merge branch 'fh/mimetypes' 2012-03-18 21:01:28 +00:00
Lars Hjemli
2b9fab8d30 Merge branch 'lh/module-links' 2012-03-18 20:59:36 +00:00
Lars Hjemli
04254fa903 Merge branch 'stable' 2012-01-03 16:06:58 +00:00
Tim Chen
f2ced535e9 Fix diff mode switching when side-by-side-diffs=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.
2012-01-03 16:02:14 +00:00
Ferry Huberts
d01c600c17 ui_plain: automatically lookup mimetype when mimetype-file is set
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-07-19 09:30:07 +00:00
Lars Hjemli
6857bec50a ui-tree.c: add support for path-selected submodule links
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-15 10:40:13 +02:00
Lars Hjemli
a1429dbc89 cgit.c: add 'clone-url' setting with support for macro expansion
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-13 23:04:30 +00:00
Lars Hjemli
3ec6b30950 cgit.c: always setup cgit repo environment variables
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-06-13 23:03:46 +00:00
Lars Hjemli
ab350a77b1 Merge branch 'fh/filter-api'
Conflicts:
	cgit.c
2011-05-23 23:28:38 +02:00
Lars Hjemli
4837fddc35 Merge branch 'dm/disable-clone' 2011-05-14 20:00:33 +02:00
Ferry Huberts
d87bba846d cgit_open_filter: also take the repo as a parameter
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>
2011-03-26 11:03:42 +01:00
Ferry Huberts
9240a828d1 new_filter: determine extra_args from filter type
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-26 11:03:41 +01:00
Dan McGee
42231328d3 Allow disabling of HTTP clone URLs
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-19 15:00:18 +01:00
Lars Hjemli
979c460e7f Merge branch 'br/misc'
* br/misc:
  Use transparent background for the cgit logo
  ssdiff: anchors for ssdiff
  implement repo.logo and repo.logo-link
2011-02-19 14:51:00 +01:00
Bernhard Reutner-Fischer
808c685ebb implement repo.logo and repo.logo-link
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-19 14:41:39 +01:00
Lars Hjemli
fb9e6d1594 Merge branch 'jh/scan-path'
* jh/scan-path:
  scan_path(): Do not recurse into hidden directories by default
  scan_path(): Improve handling of inaccessible directories
2011-02-19 14:25:55 +01:00
Johan Herland
df522794c3 scan_path(): Do not recurse into hidden directories by default
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>
2011-02-19 14:25:14 +01:00
Johan Herland
9a8d39c668 ui-log: Implement support for commit graphs
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-16 08:18:36 +01:00
Johan Herland
1415f3f3e0 ui-log: Fix filecount/linecount when path limit is in effect
When using ui-log with path limits, the listing of commits enables parent
rewriting in Git's internal log machinery. This did not work well together
with cgit_diff_commit() which is used to generate the filecount and
linecount numbers for each commit in the log view. cgit_diff_commit() would
operate without any path limits, and would therefore process the full diff
between the commits shown (which, because of parent rewriting, is not the
same as processing the diff for the commit itself). Additionally, the bottom
commit in the log view would (again, because of parent rewriting) have zero
parents, causing us to process the entire diff between the empty tree and
that commit. Since path limits were not in effect, this would (in large
projects) reports thousands of files and millions of lines changed in that
bottom commit.

This patch fixes the issue by applying the same path limit to
cgit_diff_commit() as is applied to the rest of the log view. The result is
that the filecount/linecount now only reflects the diff as it pertains to
the given path limit.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-09 16:37:39 +01:00
Felix Hanley
e0c6f23789 Add strict-export option
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-11-08 19:41:13 +01:00
Lars Hjemli
a9d6e6e695 Merge branch 'ml/bugfix' 2010-09-19 19:00:05 +02:00
Lars Hjemli
536c7a1eb2 Merge branch 'lh/section-from-path'
Conflicts:
	scan-tree.c
2010-09-19 18:46:17 +02:00
Mark Lodato
a4c58d92bf use __attribute__ to catch printf format mistakes
Use "__attribute__((format (printf,N,M)))", as is done in git, do catch
mistakes in printf-style format strings.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
2010-09-04 11:11:40 -04:00
Lars Hjemli
797110e39d Add support for 'section-from-path' option
This option can be used to autogenerate section names during scan-path
processing.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-22 13:35:56 +02:00
Lars Hjemli
515edb0da3 Add support for "readme" option
The value of this option is used as the default value for repo.readme.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-22 13:35:47 +02:00
Lars Hjemli
aec9c245e7 Merge branch 'jd/gitolite' 2010-08-04 03:10:29 +02:00
Jeff Smith
059b39344f ui-commit: Display git notes when present
Signed-off-by: Jeff Smith <whydoubt@yahoo.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-04 03:10:07 +02:00
Jason A. Donenfeld
119397b175 Add support for 'enable-gitweb-owner' option
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-04 03:09:32 +02:00
Jason A. Donenfeld
2e4a941626 Add support for 'remove-suffix' option
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-04 03:09:32 +02:00
Jason A. Donenfeld
3516502aa0 Add support for 'project-list' option
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-08-04 03:09:32 +02:00
Lars Hjemli
6821d8ea4a Merge branch 'jh/ignorews' 2010-07-18 15:03:30 +02:00
Lars Hjemli
5c5d189635 Merge branch 'lh/macros' 2010-07-18 15:03:08 +02:00
Johan Herland
2cc8b99f08 Add URL parameter 'ignorews' for optionally ignoring whitespace in diffs
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>
2010-07-18 10:53:48 +02:00
Lars Hjemli
6f92f332e6 Merge branch 'jh/context-lines'
Conflicts:
	cgit.c
	cgit.h
2010-06-22 16:16:12 +02:00
Lars Hjemli
37a24e4e39 Merge branch 'jh/path-limit'
Conflicts:
	cgit.h
	ui-commit.c
2010-06-22 16:15:48 +02:00
Johan Herland
6180e6169d Add URL parameter 'context' for changing the number of context lines in diffs
The new ctx.qry.context variable is picked up by cgit_print_diff(), and
passed via cgit_diff_files() to Git's diff machinery.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-06-19 13:00:07 +02:00
Lars Hjemli
c2766deb67 Merge branch 'ag/atom-fixes' 2010-06-19 11:42:12 +02:00
Johan Herland
0ff143df70 struct cgit_cmd: Differentiate between various usages of ctx.qry.path
For many commands/pages (e.g. 'tree', 'diff', 'plain', etc.), the
ctx.qry.path argument is interpreted as a path within the "virtual" project
directory structure. However, for some other commands (notably 'refs', and
the clone-related commands) ctx.qry.path is used in a different context (as
a more or less "real" path within the '.git' directory).

This patch differentiates between these two usages of ctx.qry.path, by
introducing a new variable - ctx.qry.vpath - which is equal to ctx.qry.path
in the former case, and NULL in the latter.

This will become useful in future patches when we want various pages and the
links between them to preserve existing in-project paths.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-06-19 10:40:22 +02:00
Aaron Griffin
80476b0d28 Add 'max-atom-items' config variable
This allows one to specify the items in the RSS feeds

Signed-off-by: Aaron Griffin <agriffin@datalogics.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-03-22 23:46:00 +01:00
Aaron Griffin
65ced7c009 Add all=1 query param for atom feeds
Displays all items from all branches in one feed

Signed-off-by: Aaron Griffin <agriffin@datalogics.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-03-22 23:41:38 +01:00
Lars Hjemli
ba56a37e86 Add support for environment variable expansion
This patch teaches cgit to expand environment variables in certain
cgitrc option values (cache_root, scan-path, include) plus when
finding the location of cgitrc itself.

One use case for this feature is virtual hosting - e.g. by setting
$CGIT_CONFIG='/etc/cgitrc/$HTTP_HOST' in httpd.conf, all virtual
hosts automatically gets their own cgitrc.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-03-22 00:09:43 +01:00
Lars Hjemli
581a0c2a54 Optionally generate verbose parent links
The new option 'enable-subject-links' must be used to enable the verbose
parent-links in commit view.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-02-27 13:12:55 +01:00
Lars Hjemli
4e75d7c9b9 Merge branch 'lh/remote-branches' 2009-12-08 19:34:30 +01:00
Lars Hjemli
f4f6210b4f Merge branch 'ro/ssdiff' 2009-12-08 19:32:48 +01:00
Georg Lukas
ef07ccc72d "max-blob-size" config var to limit generated HTML size
Sometimes it is not feasible to generate the HTML pretty-print for large
files, especially if a source-filter is involved or binary data is to be
displayed. The "max-blob-size" config var allows to disable HTML output
for blobs bigger than X KBytes. Plain downloads are not affected.

Signed-off-by: Georg Lukas <georg@op-co.de>
2009-11-28 03:44:33 +01:00
Lars Hjemli
41934a3222 Add support for remote branches
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-11-07 19:10:58 +01:00
Ragnar Ouchterlony
c358aa3dfe Add possibility to switch between unidiff and side-by-side-diff.
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>
2009-09-16 20:17:56 +02:00
Lars Hjemli
92f6940975 Merge branch 'lh/repo-scan' 2009-09-13 22:02:07 +02:00
Lars Hjemli
2273c2c821 Add config option 'enable-filter-overrides'
This option must be enabled if repo-specific cgitrc files should be
allowed to override any of the 'filter' options.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-24 10:22:59 +02:00
Lars Hjemli
74061ed5f0 Add support for repo-local cgitrc file
When recursively scanning a directory tree looking for git repositories,
cgit will now parse cgitrc files found within such repositories.

The repo-specific config files can include any repo-specific options
except 'repo.url' and 'repo.path'. Also, in such config files the 'repo.'
prefix can not be used, i.e. the valid options then becomes:
* name
* clone-url
* desc
* ower
* defbranch
* snapshots
* enable-log-filecount
* enable-log-linecount
* max-stats
* module-link
* section
* about-filter
* commit-filter
* source-filter
* readme

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-24 10:22:58 +02:00
Lars Hjemli
e7af002d5c Introduce 'section' as canonical spelling for 'repo.group'
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>
2009-08-24 10:22:58 +02:00
Lars Hjemli
d746827ec4 cgit.c: add support for caching autodetected repositories
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-24 10:22:57 +02:00
Lars Hjemli
b0f946bcc7 Rename "linenumbers" to "enable-tree-linenumbers", change default to "1"
This makes the name of the cgitrc option more descriptive and at the
same time changes the default from "0" to "1" in an attempt to stay
backwards compatible - prior to the introduction of "source-filter"
and "linenumbers", cgit always generated linenumber links in the
tree view, but now this feature can be turned off (one might want to
do this if the source-filter performs line-wrapping etc).

While at it, the documentation is updated to match the surrounding
descriptions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-21 14:26:52 +02:00
Florian Pritz
d67cc7f9d5 Add 'linenumbers' config option
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-21 14:17:49 +02:00
Lars Hjemli
e16f178334 Add and use a common readfile() function
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>
2009-08-18 17:22:14 +02:00
Lars Hjemli
8b2252b0b6 ui-shared: add support for NO_HTTP=1/--nohttp
cgit_print_http_headers() used to do nothing if 'embedded' was
specified in cgitrc, but that was wrong - we never want to skip the
headers when invoked as a CGI app. Sadly, there's no easy way to
detect if we're invoked as a CGI app or if we're invoked by another
CGI app, so for the latter case cgit needs to be invoked with either
--nohttp on the command line or NO_HTTP=1 in the environment.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-10 09:20:17 +02:00
Lars Hjemli
60a26272e0 Cleanup handling of environment variables
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-10 08:21:09 +02:00
Lars Hjemli
db8b8cb946 Merge branch 'lh/about'
Conflicts:
	cgit.h
2009-08-09 13:46:34 +02:00
Lars Hjemli
db6303b588 Merge branch 'lh/plugins'
Conflicts:
	cgit.c
	cgit.h
2009-08-09 13:46:01 +02:00
Lars Hjemli
17e3ff4264 Merge branch 'lh/mimetypes' 2009-08-09 13:45:36 +02:00
Lars Hjemli
537c05f138 Add 'about-filter' and 'repo.about-filter' options
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>
2009-08-09 13:41:54 +02:00
Lars Hjemli
e976df2795 Add support for repo.commit-filter and repo.source-filter
These options can be used to override the default commit- and source-
filter settings per repository.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-09 13:22:00 +02:00
Martin Szulecki
2f56e390f0 Introduce noplainemail option to hide email adresses from spambots
Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
2009-08-08 14:23:28 +02:00
Lars Hjemli
f35db1cd2b ui-commit: add support for 'commit-filter' option
This new option specifies a filter which is executed on the commit
message, i.e. the commit message is written to the filters STDIN and
the filters STDOUT is included verbatim as the commit message.

This can be used to implement commit linking by creating a simple
shell script in e.g. /usr/bin/cgit-commit-filter.sh like this:

#/bin/sh
sed -re 's|\b([0-9a-fA-F]{6,40})\b|<a href="./?id=\1">\1</a>|g'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-31 17:42:57 +02:00
Lars Hjemli
46b7abed99 ui-tree: add support for source-filter option
This new option is used to specify an external command which will be
executed when displaying blob content in the tree view. Blob content
will be written to STDIN of the filter and STDOUT from the filter
will be included verbatim in the html output from cgit. The file name
of the blob will be passed as the only argument to the filter command.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-31 17:41:21 +02:00
Lars Hjemli
d6f6072560 Add generic filter/plugin infrastructure
The functions cgit_open_filter() and cgit_close_filter() can be used to
execute filters on the output stream from cgit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-31 17:39:51 +02:00
Lars Hjemli
c4d46c7035 Add support for mime type registration and lookup
This patch makes it possible to register mappings from filename
extension to mime type in cgitrc and use this mapping when returning
blob content in `plain` view.

The reason for adding this mapping to cgitrc (as opposed to parsing
something like /etc/mime.types) is to allow quick lookup of a limited
number of filename extensions (/etc/mime-types on my machine currently
contains over 700 entries).

NB: A nice addition to this patch would be to parse /etc/mime.types
when `plain` view is requested for a file with an extension for which
there is no mapping registered in cgitrc.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-25 12:55:15 +02:00
Lars Hjemli
286a905842 Merge branch 'lh/embedded'
Conflicts:
	cgitrc.5.txt
	ui-shared.c
2009-07-25 12:29:22 +02:00
Lars Hjemli
7a8b3b4104 cgit.h: keep config flags sorted
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-25 12:25:06 +02:00
Lars Hjemli
ef0c6aadf7 Add support for 'noheader' option
This option can be used to disable the standard cgit page header, which
might be useful in combination with the 'embedded' option.

Suggested-by: Mark Constable <markc@renta.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-25 12:19:31 +02:00
Lars Hjemli
542f6a4330 Merge branch 'ml/head-include' 2009-07-25 12:04:08 +02:00
Lars Hjemli
681fdc4547 Merge branch 'plain-etag'
Conflicts:
	ui-shared.c
2009-07-25 11:59:22 +02:00
Lars Hjemli
e429fb0cca Return http statuscode 404 on unknown branch
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-06-07 20:43:08 +02:00
Mark Lodato
b5a3a20496 Add head-include configuration option.
This patch adds an option to the configuration file, "head-include",
which works just like "header" or "footer", except the content is put
into the HTML's <head> tag.
2009-06-07 18:55:44 +02:00
Lars Hjemli
488a214a81 Add support for ETag in 'plain' view
When downloading a blob identified by its path, the client might want
to know if the blob has been modified since a previous download of the
same path. To this end, an ETag containing the blob SHA1 seems to be
ideal.

Todo: add support for HEAD requests...

Suggested-by: Owen Taylor <otaylor@redhat.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-02-19 22:38:36 +01:00
Lars Hjemli
0cbb50841a Add support for an 'embedded' option in cgitrc
When activated, cgit will neither generate http headers nor any 'framing'
html elements (like <html> and <body>). Also, all page content is now
wrapped in a <div id='cgit'> element to make it easier to select the
correct cgit classes when embedded/themed.

Suggested-by: Matt Sealey <matt@genesi-usa.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-02-02 08:11:29 +01:00
Lars Hjemli
5e447b1ed1 Merge branch 'lh/binary' 2009-02-01 19:29:47 +01:00
Lars Hjemli
c495cf02ba Handle binary files in diffs
This teaches all diff-related operations (i.e. ui-log, ui-diff and ui-patch)
how to handle binary files.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-01-31 10:40:40 +01:00
Lars Hjemli
b115955d71 Add support for a custom header
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-01-29 21:27:39 +01:00
Lars Hjemli
7710178e45 Merge branch 'lh/stats'
Conflicts:
	cgit.c
	cgit.css
	cgit.h
	ui-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-01-27 20:16:37 +01:00
Lars Hjemli
fb2f3f6c29 ui-stats: replace 'enable-stats' setting with 'max-stats'
The new 'max-stats' and 'repo.max-stats' settings makes it possible to
define the maximum statistics period, both globally and per repo. Hence,
it is now feasible to allow statistics on repositories with a high commit
frequency, like linux-2.6, by setting repo.max-stats to e.g. 'month'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-07 13:17:21 +01:00
Lars Hjemli
f86a23ff53 Add a 'stats' page to each repo
This new page, which is disabled by default, can be used to print some
statistics about the number of commits per period in the repository,
where period can be either weeks, months, quarters or years.

The function can be activated globally by setting 'enable-stats=1' in
cgitrc and disabled for individual repos by setting 'repo.enable-stats=0'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-06 17:38:19 +01:00
Lars Hjemli
3c32fe0771 Merge branch 'full-log'
Conflicts:
	cgit.c
	cgit.h
2008-12-06 11:37:37 +01:00
Lars Hjemli
9c8be943f7 Merge branch 'lh/sort-repolist' 2008-12-06 11:35:49 +01:00
Ramsay Jones
97fdac1608 Extra cygwin-specific changes
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-03 23:39:30 +01:00
Lars Hjemli
0274b57d55 ui-log: add support for showing the full commit message
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>
2008-11-29 18:39:41 +01:00
Lars Hjemli
8813170390 ui-repolist: implement lazy caching of repo->mtime
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>
2008-11-29 16:46:37 +01:00
Benjamin Close
d71c0c725d Add support for sorting by Age in the repolist
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-11-29 13:25:54 +01:00
Lars Hjemli
5632ba35d1 Add cgit_query.nohead flag
This flag is set when no HEAD is specified in the querystring. Currently
it has no users, but it will be used by ui-snapshot to invoke a DWIM-mode
where the revision is extracted from the snapshot name.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-10-11 19:05:50 +02:00
Lars Hjemli
e154edd807 Teach cgit how to use PATH_INFO
This commit makes cgit use the cgi variables SCRIPT_NAME and PATH_INFO
when virtual-root is unspecified in cgitrc and no url-parameter is
specified on the querystring. This has two nice effects:

* Virtual urls works out of the box, no more need for rewrite-rules in httpd.
* Virtual urls with special querystring characters are handled correctly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-09-15 23:00:30 +02:00
Lars Hjemli
a8305a9543 parsing.c: be prepared for unexpected content in commit/tag objects
When parsing commits and tags cgit made too many assumptions about the
formatting of said objects. This patch tries to make the code be more
prepared to handle 'malformed' objects.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-09-15 22:33:11 +02:00