Commit Graph

55 Commits

Author SHA1 Message Date
Christian Hesse e1ad15d368 ui-tree: allow per repository override for enable-blame
The blame operation can cause high cost in terms of CPU load for huge
repositories. Let's add a per repository override for enable-blame.

Signed-off-by: Christian Hesse <mail@eworm.de>
2019-06-25 21:40:59 +02:00
Jeff Smith c1cd290d1f ui-blame: add blame UI
Implement a page which provides the blame view of a specified file.

This feature is controlled by a new config variable, "enable-blame",
which is disabled by default.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
2017-10-03 19:19:34 +01:00
Jason A. Donenfeld 09a3aa5ae7 about: path_info might not be valid 2016-02-26 13:14:52 +01:00
Jason A. Donenfeld 94c02bbf73 cmd: redirect empty about/ to homepage or summary
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2016-02-22 18:40:15 +01:00
Christian Hesse 6f2e4400fa cmd: fix resource leak: free allocation from cgit_currenturl and fmtalloc
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-10-09 14:03:58 +02:00
John Keeping 73ef8567f0 cmd: fix command definition
The previous commit removed the "pre" field from "struct cgit_cmd" but
forgot to update this macro.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
2015-08-14 16:41:22 +02:00
Jason A. Donenfeld 03de473354 cmd: no need for pre function hook now
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2015-08-14 15:54:32 +02:00
John Keeping a420c7ce9b cmd: remove "want_layout" field
No commands use this any more.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 9c70c0bfdb tree: move layout into page function
This also allows us to return proper HTTP error codes when the requested
tree is not found and display an error message in one case (invalid path
inside valid commit) where we previously just displayed an empty page.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 696a33b66f tag: move layout into page function
This also allows us to return proper HTTP error codes when something
goes wrong.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping a3daa41b78 summary: move layout into page function
Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 892c5441f4 stats: move layout into page function
This also allows us to return proper HTTP error codes for invalid
requests.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 6d39dd1914 refs: move layout to page function
Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 23c17d8ff0 log: move layout into page function
Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 3b220eb22d diff: move layout to page function
The existing "show_ctrls" flag is used to control whether we are running
in an existing page or control the page ourselves.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping c53a15c77a commit: move layout into page function
This allows us to return a proper HTTP status code when an object is not
found by switching from cgit_print_error() to cgit_print_error_page().

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
John Keeping 51d9176e4b about: move layout into page functions
Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14 15:46:51 +02:00
Jason A. Donenfeld 622e64d5f2 redirect: be more careful for different cgi setups 2015-08-13 11:39:20 +02:00
Jason A. Donenfeld d7034806a4 about: always ensure page has a trailing slash
Otherwise we can't easily embed links to other /about/ pages.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2015-08-12 15:03:32 +02:00
Lukas Fleischer 3e9578e9a3 Remove unused parameter from cgit_print_snapshot() 2014-02-21 18:19:00 +01:00
Lukas Fleischer f60ffa143c Switch to exclusively using global ctx
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>
2014-01-17 00:44:54 +01:00
Lukas Fleischer f7f26f8875 Update copyright information
* Name "cgit Development Team" as copyright holder to avoid listing
  every single developer.

* Update copyright ranges.

Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
2014-01-08 15:10:49 +01:00
Lukas Fleischer 750f6462c9 Allow for creating patch series
This allows for specifying a revision range using the id2 parameter of
/patch/. The output that is produced is similar to

    $ git format-patch --stdout id2..id

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-20 19:55:42 +02:00
Lukas Fleischer 445f6ae8e3 cmd.c: Add a "rawdiff" command
This can be used to generate raw diffs between arbitrary revisions using
something like

     /rawdiff/?id=v0.9&id2=v0.9.1

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-16 13:15:37 -06:00
Lukas Fleischer 9003cc172a Allow for creating raw diffs with cgit_print_diff()
This adds a parameter to cgit_print_diff() to create raw diffs, using
the same format as `git diff <commit>`.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-16 13:15:37 -06:00
Jason A. Donenfeld dcbc0438b2 readme: use string_list instead of space deliminations
Now this is possible in cgitrc -

readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install

Suggested-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-05-26 16:30:03 +02:00
Jason A. Donenfeld bdae1d8a8d White space around control verbs.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-03-04 09:12:54 -05: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
Lars Hjemli 2ffeecb7a6 Merge branch 'lh/panel' 2011-05-23 23:29:24 +02:00
Lars Hjemli 4837fddc35 Merge branch 'dm/disable-clone' 2011-05-14 20:00:33 +02:00
Lars Hjemli 962a24892f ui-diff.c: create a control panel for diff options
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-03-06 23:59:56 +01:00
Dan McGee 35d33014fb Add is_clone flag to available commands
This will be used to make these operations configurable via a config
option.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-02-19 14:57:48 +01:00
Johan Herland ad230267f8 ui-log: Line-wrap long commit subjects when showmsg is enabled
When showmsg is disabled ui-log truncates long commit subjects. This is good.
However, the same is not desirable when showmsg is enabled, since you then
end up with a truncated commit subject followed by the rest of the commit
message below.

Instead, when showmsg is enabled (and we're using all this space to display
the entire commit message, anyway), line-wrap the commit subject instead of
truncating it.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-16 08:18:37 +01: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 eac1b67541 ui-patch: Apply path limit to generated patch
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>
2010-06-19 10:40:23 +02:00
Johan Herland ab42741c49 ui-commit: Limit diff based on path limit in qry.path
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-06-19 10:40:23 +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
Lars Hjemli e1782fff8a ui-summary: enable arbitrary paths below repo.readme
This change makes it possible to include any number of pages below
the 'about' tab for a repository. The path is assumed to be located
in the same directory as the 'repo.readme' file.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-08-09 13:41:54 +02: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
Natanael Copa 314d9ea5a3 Set prefix in snapshots when using dwimmery
This patch sets the directory prefix in archives to be the filename,
excluding the suffix (.tar.gz, .tar.bz2 etc).

The patch also removes the prefix parameter in cgit_print_snapshot()
as the prefix might differ.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-11-30 13:39:53 +01:00
Lars Hjemli ed7ff095ca ui-snapshot: add dwimmery
When downloading a snapshot, the snapshot name will often contain the repo
name combined with a tag. This patch tries to exploit this so that the
correct revision is downloaded even if no specific revision is specified.

PS: this only occurs if neither 'h' nor 'id' is specified in the query-
string.

PPS: this also fixes a bug which occurs when trying to download a filename
with an unsupported suffix: it used to try to print an error message to
the user but failed since it didn't prepare the output properly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-10-11 20:09:42 +02:00
Lars Hjemli d532c4d161 Merge branch 'lh/plain'
* lh/plain:
  Supply status description to html_status()
  ui-tree: link to plain view instead of blob view
  Implement plain view
2008-09-01 22:40:55 +02:00
Lars Hjemli 288d502b3d Merge branch 'lh/clone'
* lh/clone:
  Add support for cloning over http

Conflicts:
	cmd.c
2008-09-01 22:40:24 +02:00
Lars Hjemli e5da4bca54 Implement plain view
This implements a way to access plain blobs by path (similar to the
tree view) instead of by sha1.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-08-06 11:21:30 +02:00
Lars Hjemli 02a545e634 Add support for cloning over http
This patch implements basic support for cloning over http, based on the
work on git-http-backend by Shawn O. Pearce.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-08-06 11:21:09 +02:00
Lars Hjemli b2a3d31e88 Add atom-support
This enables a page which generates atom feeds for the current branch and
path, heavily inspired by the atom-support in gitweb.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-08-01 22:12:34 +02:00
Michael Krelin 01d2dce7e7 allow blob extract blobs by head/path combination
If blob is invoked with no id=, it tries to look up h= and search for path= in
 there. Once found, proceed as normal, otherwise, fail as normal.

Signed-off-by: Michael Krelin <hacker@klever.net>
2008-06-24 23:33:24 +02:00