]> git.cameronkatri.com Git - cgit.git/log
cgit.git
14 years agoui-commit: Preserve path limit in links to commit page
Johan Herland [Wed, 9 Jun 2010 23:09:35 +0000 (01:09 +0200)]
ui-commit: Preserve path limit in links to commit page

This includes adding a path argument to cgit_commit_link() and updating all
its callers. The callers from within the commit page (i.e. the "commit",
"unidiff"/"side-by-side diff" and "parent" links) all preserve the path
limit of the current commit page. All other callers pass NULL (i.e. no path
limit).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-commit: Preserve path limit in links to tree and diff pages
Johan Herland [Wed, 9 Jun 2010 23:09:34 +0000 (01:09 +0200)]
ui-commit: Preserve path limit in links to tree and diff pages

For tree links, the original link is unchanged, but in the case of a path
limit, a subtree link is added to the right of the original tree link.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-patch: Apply path limit to generated patch
Johan Herland [Wed, 9 Jun 2010 23:09:33 +0000 (01:09 +0200)]
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>
14 years agoui-commit: Limit diff based on path limit in qry.path
Johan Herland [Wed, 9 Jun 2010 23:09:32 +0000 (01:09 +0200)]
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>
14 years agoui-diff: Teach diffstat to obey path limit
Johan Herland [Wed, 9 Jun 2010 23:09:31 +0000 (01:09 +0200)]
ui-diff: Teach diffstat to obey path limit

Also indicate in the diffstat header if a path limit is in effect.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-tree: Remove unnecessary path breadcrumb navigation
Johan Herland [Wed, 9 Jun 2010 23:09:30 +0000 (01:09 +0200)]
ui-tree: Remove unnecessary path breadcrumb navigation

The path breadcrumb navigation at the top of the 'tree' page has now been
duplicated in ui-shared, which leaves the ui-tree implementation unnecessary.

This patch removes the breadcrumb navigation from ui-tree, and moves the
"(plain)" link that followed the breadcrumb when displaying blobs to the
end of the next line, following the blob SHA1.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-shared: Teach "breadcrumb" navigation to path limit display beneath tab bar
Johan Herland [Wed, 9 Jun 2010 23:09:29 +0000 (01:09 +0200)]
ui-shared: Teach "breadcrumb" navigation to path limit display beneath tab bar

When a path limit is in effect, and displayed directly beneath the tab bar,
it should offer breadcrumb navigation (like what the 'tree' page does), to
allow changing the path limit easily.

Implementing this requires a robust way to link back to the current page with
a changed ctx->qry.path, but without losing track of the other query
arguments. This is solved by adding the new cgit_self_link() function, which
is then invoked repeatedly by the new cgit_print_path_crumbs() function while
manipulating ctx->qry.path.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-shared: Display path limit directly beneath tab bar in relevant pages
Johan Herland [Wed, 9 Jun 2010 23:09:28 +0000 (01:09 +0200)]
ui-shared: Display path limit directly beneath tab bar in relevant pages

Design-wise, the path is shown by "expanding" the grey border between the
tab bar and the content area of the page to house the current path limit.

This is only displayed on pages where the path limit is relevant, and only
when a path limit is in effect.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-shared: Replace ctx.qry.path with ctx.qry.vpath
Johan Herland [Wed, 9 Jun 2010 23:09:27 +0000 (01:09 +0200)]
ui-shared: Replace ctx.qry.path with ctx.qry.vpath

In all cases where ui-shared uses ctx.qry.path, it is done so in the context
of a in-project path, and not in the context in which the 'refs' page or the
'clone'-related functionality uses ctx.qry.path. Make this explicit by using
ctx.qry.vpath instead.

This path introduces no fundamental difference in functionality except for
fixing some minor bugs, for example the Atom feed reference from a
"$repo/refs/heads/" page.

Note that the usage of ctx.qry.path in the other ui-<page>.c files is ok,
since that code presumably is only executed in the context of its own <page>,
so the correct interpretation of ctx.qry.path is never in question.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agostruct cgit_cmd: Differentiate between various usages of ctx.qry.path
Johan Herland [Wed, 9 Jun 2010 23:09:26 +0000 (01:09 +0200)]
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>
14 years agoui-shared: Remove needless cgit_get_cmd() call, and refactor hc() accordingly
Johan Herland [Wed, 9 Jun 2010 23:09:25 +0000 (01:09 +0200)]
ui-shared: Remove needless cgit_get_cmd() call, and refactor hc() accordingly

The call to cgit_get_cmd() and the following fallback handling (to "summary"
or "repoindex") in cgit_print_pageheader() is unnecessary, since the same
fallback handling was already done when ctx.qry.page was set when
cgit_get_cmd() was called from process_request() in cgit.c.

As such, hc() can also be rewritten to simply compare the given 'page' string
against ctx.qry.page.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-shared: Improve const-ness in API
Johan Herland [Wed, 9 Jun 2010 23:09:24 +0000 (01:09 +0200)]
ui-shared: Improve const-ness in API

This is needed to prevent const-related warnings in later patches.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoRemove unused variable in shared.c
Johan Herland [Wed, 9 Jun 2010 23:09:23 +0000 (01:09 +0200)]
Remove unused variable in shared.c

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoFix small typo in cgitrc example
Johan Herland [Wed, 9 Jun 2010 23:09:22 +0000 (01:09 +0200)]
Fix small typo in cgitrc example

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-tree: add link to plain view for blobs in tree listing
Lars Hjemli [Sun, 28 Feb 2010 21:18:00 +0000 (22:18 +0100)]
ui-tree: add link to plain view for blobs in tree listing

Suggested-by: Robert Weidlich <mail@robertweidlich.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoUse GIT-1.7.0
Lars Hjemli [Sat, 27 Feb 2010 12:39:53 +0000 (13:39 +0100)]
Use GIT-1.7.0

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoMerge branch 'html-updates' of git://github.com/MarkLodato/cgit
Lars Hjemli [Sat, 27 Feb 2010 12:20:27 +0000 (13:20 +0100)]
Merge branch 'html-updates' of git://github.com/MarkLodato/cgit

14 years agoMerge branch 'stable'
Lars Hjemli [Sat, 27 Feb 2010 11:53:27 +0000 (12:53 +0100)]
Merge branch 'stable'

14 years agoClear the whole context
Daniel Milde [Sun, 21 Feb 2010 13:38:59 +0000 (14:38 +0100)]
Clear the whole context

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agoui-shared.c: fix segfault when repo is empty
Florian Pritz [Mon, 1 Feb 2010 16:55:37 +0000 (17:55 +0100)]
ui-shared.c: fix segfault when repo is empty

PATH_INFO="/$REPONAME/commit/?id=1" QUERY_STRING="id=1" ./cgit.cgi
triggers segfault when the repository is empty and therefore
ctx.qry.head is unset

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years agohtml: properly percent-escape URLs
Mark Lodato [Tue, 9 Feb 2010 15:12:43 +0000 (10:12 -0500)]
html: properly percent-escape URLs

The only valid characters for a URL are unreserved characters
a-zA-Z0-9_-.~ and the reserved characters !*'();:@&=+$,/?%#[] , as per
RFC 3986.  Everything else must be escaped.  Additionally, the # and
? always have special meaning, and the &, =, and + have special meaning
in a query string, so they too must be escaped.  To make this easier,
a table of escapes is now used so that we do not have to call fmt() for
each character; if the entry is 0, no escaping is needed.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
14 years agohtml: make all strings 'const char *'
Mark Lodato [Tue, 9 Feb 2010 04:04:41 +0000 (23:04 -0500)]
html: make all strings 'const char *'

None of the html_* functions modify their argument, so they can all be
'const char *' instead of a simple 'char *'.  This removes the need to
cast (or copy) when trying to print a const string.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
15 years agoMerge branch 'stable'
Lars Hjemli [Sat, 12 Dec 2009 11:09:47 +0000 (12:09 +0100)]
Merge branch 'stable'

15 years agoCGIT 0.8.3.1 v0.8.3.1
Lars Hjemli [Sat, 12 Dec 2009 11:08:14 +0000 (12:08 +0100)]
CGIT 0.8.3.1

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoFix segfault on ppc when browsing tree
Martins Polakovs [Thu, 10 Dec 2009 15:35:42 +0000 (17:34 +0159)]
Fix segfault on ppc when browsing tree

15 years agoAdd .tar.xz-snapshot support
Andreas Wiese [Tue, 8 Dec 2009 21:18:11 +0000 (22:18 +0100)]
Add .tar.xz-snapshot support

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoMerge branch 'lh/remote-branches'
Lars Hjemli [Tue, 8 Dec 2009 18:34:30 +0000 (19:34 +0100)]
Merge branch 'lh/remote-branches'

15 years agoMerge branch 'ro/ssdiff'
Lars Hjemli [Tue, 8 Dec 2009 18:32:48 +0000 (19:32 +0100)]
Merge branch 'ro/ssdiff'

15 years agoMerge branch 'master' of http://op-co.de/cgit
Lars Hjemli [Tue, 8 Dec 2009 17:31:07 +0000 (18:31 +0100)]
Merge branch 'master' of http://op-co.de/cgit

15 years agoMerge branch 'stable'
Lars Hjemli [Tue, 8 Dec 2009 17:30:02 +0000 (18:30 +0100)]
Merge branch 'stable'

15 years agoDon't crash when a repo-specific readme file is used
Sami Kyöstilä [Tue, 8 Dec 2009 17:18:10 +0000 (18:18 +0100)]
Don't crash when a repo-specific readme file is used

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago"max-blob-size" config var to limit generated HTML size
Georg Lukas [Sat, 28 Nov 2009 02:44:33 +0000 (03:44 +0100)]
"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>
15 years agocgit.css: highlight directories in tree
Georg Lukas [Sat, 28 Nov 2009 02:07:34 +0000 (03:07 +0100)]
cgit.css: highlight directories in tree

15 years agosyntax highlighting for all formats supported by "highlight"
Georg Lukas [Thu, 19 Nov 2009 11:14:45 +0000 (12:14 +0100)]
syntax highlighting for all formats supported by "highlight"

The highlight tool can be given any of the supported file extensions
as its -S parameter. This patch replaces the case-switch by extracting
the extension from the supplied file name and passing it to highlight.
However, this requires a shell supporting the ${var##pattern} syntax,
like dash or bash.

Unknown extensions cause a fall-back to plain text using the --force
switch. Error messages are redirected to /dev/null.

A special case maps Makefile and Makefile.* to the "mk" extension.

The total overhead is reduced by calling "exec highlight". No forks are
needed during script execution.

Signed-off-by: Georg Lukas <georg@op-co.de>
15 years agoAdd support for remote branches
Lars Hjemli [Sat, 7 Nov 2009 18:10:58 +0000 (19:10 +0100)]
Add support for remote branches

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoMerge branch 'stable'
Lars Hjemli [Sat, 7 Nov 2009 17:16:50 +0000 (18:16 +0100)]
Merge branch 'stable'

15 years agoshared.c: return original errno
Lars Hjemli [Sat, 7 Nov 2009 17:08:30 +0000 (18:08 +0100)]
shared.c: return original errno

Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoAdd NO_OPENSSL option
Mikhail Gusarov [Wed, 28 Oct 2009 21:39:55 +0000 (03:39 +0600)]
Add NO_OPENSSL option

Linking with OpenSSL is not always desirable. Add NO_OPENSSL option
to use SHA-1 code bundled with Git.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
15 years agoIn side-by-side diff, add support for marking individual characters.
Ragnar Ouchterlony [Sun, 25 Oct 2009 17:13:22 +0000 (18:13 +0100)]
In side-by-side diff, add support for marking individual characters.

Refuses to do so if the left hand side of the diff has different amount of
differing lines to the right hand side to avoid confusion.

Note that I use the naive dynamic programming approach for calculating the
longest common subsequence. We could probably be more efficient by using a
better algorithm. The LCS calculating function is O(n*m) and uses up n*m
amount of memory too (so if we we compare two strings of length 100, I use
an array of 10000 for calculating the LCS). Might want to not calculate LCS
if the length of the line is too large.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
15 years agoMerge branch 'stable'
Lars Hjemli [Sat, 7 Nov 2009 14:35:36 +0000 (15:35 +0100)]
Merge branch 'stable'

15 years agoClose fd on error in readfile()
Rys Sommefeldt [Sat, 7 Nov 2009 14:24:45 +0000 (15:24 +0100)]
Close fd on error in readfile()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoNov is the correct abbreviation
Danijel Tašov [Mon, 2 Nov 2009 21:10:04 +0000 (22:10 +0100)]
Nov is the correct abbreviation

15 years agoui-shared.c: prettify download links when generated from tag page
Lars Hjemli [Fri, 16 Oct 2009 00:03:32 +0000 (02:03 +0200)]
ui-shared.c: prettify download links when generated from tag page

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-tag: make output more similar to commit view
Lars Hjemli [Tue, 6 Oct 2009 18:33:04 +0000 (20:33 +0200)]
ui-tag: make output more similar to commit view

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-tag: add snapshot links
Alexey Nezhdanov [Sun, 27 Sep 2009 19:00:29 +0000 (23:00 +0400)]
ui-tag: add snapshot links

Signed-off-by: Alexey Nezhdanov <snakeru@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoSkip leading "/" in url querystring value
Stefan Bühler [Mon, 14 Sep 2009 21:37:13 +0000 (21:37 +0000)]
Skip leading "/" in url querystring value

Makes it easier to rewrite :)
lighttpd-sandbox: rewrite "/cgit.cgi?url=%{enc:request.path}&%{request.query}";

Signed-off-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoFix repolist search links with virtual root
Geoff Johnstone [Sun, 20 Sep 2009 10:32:07 +0000 (11:32 +0100)]
Fix repolist search links with virtual root

Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoFixed side-by-side diff bugs related to binary diff and more.
Ragnar Ouchterlony [Wed, 16 Sep 2009 16:56:26 +0000 (18:56 +0200)]
Fixed side-by-side diff bugs related to binary diff and more.

The fixed bugs:

 * "Binary files differ" did not show up either in unidiff or
   side-by-side-diff.
 * Subproject diffs did not work for side-by-side diffs.
 * The ssdiff link on diff pages did not conserve the path.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoPolishing of how the side-by-side diff looks.
Ragnar Ouchterlony [Tue, 15 Sep 2009 17:44:37 +0000 (19:44 +0200)]
Polishing of how the side-by-side diff looks.

Aligned all different files, so that all side-by-side tables look
the same. Also made sure that the tables take up the whole browser
width.

Also various changes to the css to make things easier on the eye.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoAdd possibility to switch between unidiff and side-by-side-diff.
Ragnar Ouchterlony [Mon, 14 Sep 2009 18:19:02 +0000 (20:19 +0200)]
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>
15 years agoFirst version of side-by-side diff.
Ragnar Ouchterlony [Sun, 13 Sep 2009 17:36:35 +0000 (19:36 +0200)]
First version of side-by-side diff.

This constitutes the first prototype of a side-by-side diff. It is not
possible to switch between unidiff and side-by-side diff at all at this
stage.

Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgitrc.5.txt: Change repo.group to section in example config.
Loui Chang [Mon, 14 Sep 2009 05:21:11 +0000 (01:21 -0400)]
cgitrc.5.txt: Change repo.group to section in example config.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgitrc.5.txt: Add mansource and manmanual.
Loui Chang [Mon, 14 Sep 2009 05:21:10 +0000 (01:21 -0400)]
cgitrc.5.txt: Add mansource and manmanual.

This prevents FIXMEs from appearing.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoCGIT 0.8.3 v0.8.3
Lars Hjemli [Sun, 13 Sep 2009 20:17:02 +0000 (22:17 +0200)]
CGIT 0.8.3

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoMerge branch 'stable'
Lars Hjemli [Sun, 13 Sep 2009 20:15:38 +0000 (22:15 +0200)]
Merge branch 'stable'

15 years agoCGIT 0.8.2.2 v0.8.2.2
Lars Hjemli [Sun, 13 Sep 2009 20:14:12 +0000 (22:14 +0200)]
CGIT 0.8.2.2

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoMerge branch 'lh/repo-scan'
Lars Hjemli [Sun, 13 Sep 2009 20:02:07 +0000 (22:02 +0200)]
Merge branch 'lh/repo-scan'

15 years agoMerge branch 'fp/linenumbers'
Lars Hjemli [Sun, 13 Sep 2009 20:01:52 +0000 (22:01 +0200)]
Merge branch 'fp/linenumbers'

15 years agoUse GIT-1.6.4.3
Lars Hjemli [Sun, 13 Sep 2009 19:56:45 +0000 (21:56 +0200)]
Use GIT-1.6.4.3

Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
15 years agoMerge branch 'stable'
Lars Hjemli [Sun, 6 Sep 2009 17:33:27 +0000 (19:33 +0200)]
Merge branch 'stable'

15 years agoui-plain.c: only return the blob with the specified path
Lars Hjemli [Sun, 6 Sep 2009 17:33:10 +0000 (19:33 +0200)]
ui-plain.c: only return the blob with the specified path

When a path to a directory was specified for the 'plain'
view, each blob in the directory used to be returned to
the client. This patch fixes the issue by matching the
path of each blob against the requested path.

Noticed-by: Lars Stoltenow <penma@penma.de>
Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
15 years agocgit.c: respect repo-local 'snapshots' option for --scan-path
Lars Hjemli [Mon, 24 Aug 2009 11:31:49 +0000 (13:31 +0200)]
cgit.c: respect repo-local 'snapshots' option for --scan-path

The repo-specific 'snapshots' option is bitwise AND'ed with the global
'snapshots' option during parsing, and since the global cgitrc hasn't
been parsed when --scan-path is processed the global 'snapshots' will
always be 0 (i.e. no repo-specific 'snapshots' setting will have any
effect).

This patch fixes the issue by setting the global 'snapshots' mask to
0xFF (hence relying on later parsing of the generated cgitrc repolist
to do the right thing).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: only print first line of repo.desc in print_repo()
Lars Hjemli [Mon, 24 Aug 2009 11:27:15 +0000 (13:27 +0200)]
cgit.c: only print first line of repo.desc in print_repo()

Since repo.desc might have been populated by reading the 'description'
file in GIT_DIR, it may contain newlines. And by printing the literal
value, we may then generate an invalid cgitrc include-file.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoAdd and use cgit_find_stats_periodname() in print_repo()
Lars Hjemli [Mon, 24 Aug 2009 09:02:48 +0000 (11:02 +0200)]
Add and use cgit_find_stats_periodname() in print_repo()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: generate repo.snapshots in print_repo()
Lars Hjemli [Mon, 24 Aug 2009 08:55:01 +0000 (10:55 +0200)]
cgit.c: generate repo.snapshots in print_repo()

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: add missing options to print_repo()
Lars Hjemli [Mon, 24 Aug 2009 08:22:21 +0000 (10:22 +0200)]
cgit.c: add missing options to print_repo()

Note: print_repo() still ignores repo.max-stats and repo.snapshots,
which both requires additional work since these settings are represented
internally as an enum and a bitmap.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoshared.c: initialize cgit_repo structs properly
Lars Hjemli [Mon, 24 Aug 2009 08:14:02 +0000 (10:14 +0200)]
shared.c: initialize cgit_repo structs properly

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoAdd config option 'enable-filter-overrides'
Lars Hjemli [Mon, 24 Aug 2009 06:53:21 +0000 (08:53 +0200)]
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>
15 years agocgitrc.5.txt: fix markup errors
Lars Hjemli [Mon, 24 Aug 2009 05:51:48 +0000 (07:51 +0200)]
cgitrc.5.txt: fix markup errors

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-repolist: handle empty sections similar to NULL sections
Lars Hjemli [Mon, 24 Aug 2009 05:42:03 +0000 (07:42 +0200)]
ui-repolist: handle empty sections similar to NULL sections

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoAdd support for repo-local cgitrc file
Lars Hjemli [Sun, 23 Aug 2009 22:04:58 +0000 (00:04 +0200)]
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>
15 years agocgit.c: refactor repo_config() from config_cb()
Lars Hjemli [Sun, 23 Aug 2009 21:23:20 +0000 (23:23 +0200)]
cgit.c: refactor repo_config() from config_cb()

The new function repo_config() is used to handle all 'simple' repo
options, for the following reasons:
* code readability
* parser performance
* upcoming support for repo-local cgitrc files during scanning

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-repolist.c: sort by section name, repo name as default
Lars Hjemli [Sun, 23 Aug 2009 21:09:31 +0000 (23:09 +0200)]
ui-repolist.c: sort by section name, repo name as default

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>
15 years agoAdd config option 'repo.section'
Lars Hjemli [Sun, 23 Aug 2009 21:00:28 +0000 (23:00 +0200)]
Add config option 'repo.section'

This option can be used to specify the section name for the current
repository.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoIntroduce 'section' as canonical spelling for 'repo.group'
Lars Hjemli [Sun, 23 Aug 2009 20:58:39 +0000 (22:58 +0200)]
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>
15 years agoAdd support for --scan-path command line option
Lars Hjemli [Sun, 23 Aug 2009 17:36:45 +0000 (19:36 +0200)]
Add support for --scan-path command line option

This is an alias for --scan-tree (which might be deprecated in the
future).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoRename 'repo.scan' to 'scan-path'
Lars Hjemli [Sun, 23 Aug 2009 17:35:56 +0000 (19:35 +0200)]
Rename 'repo.scan' to 'scan-path'

The 'repo.' prefix will soon be reserved for repo-specific config
options.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgitrc.5.txt: document repo.scan and cache-scanrc-ttl
Lars Hjemli [Thu, 20 Aug 2009 15:42:14 +0000 (17:42 +0200)]
cgitrc.5.txt: document repo.scan and cache-scanrc-ttl

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: add support for caching autodetected repositories
Lars Hjemli [Thu, 20 Aug 2009 15:41:54 +0000 (17:41 +0200)]
cgit.c: add support for caching autodetected repositories

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: make print_repolist() and print_repo() reusable for caching
Lars Hjemli [Wed, 19 Aug 2009 15:47:24 +0000 (17:47 +0200)]
cgit.c: make print_repolist() and print_repo() reusable for caching

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocache.h: export hash_str()
Lars Hjemli [Wed, 19 Aug 2009 15:43:47 +0000 (17:43 +0200)]
cache.h: export hash_str()

This function will be reused to cache the result of tree scanning.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: add support for cgitrc option 'repo.scan'
Lars Hjemli [Tue, 11 Aug 2009 08:09:06 +0000 (10:09 +0200)]
cgit.c: add support for cgitrc option 'repo.scan'

When specified, the specified path will be scanned for repositories.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoscan-tree: detect non-bare repository and stop scanning early
Lars Hjemli [Tue, 11 Aug 2009 08:08:12 +0000 (10:08 +0200)]
scan-tree: detect non-bare repository and stop scanning early

We don't want to descend into every subdirectory of a git repository
with a workdir.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgitrc.5.txt: fix description and markup for 'snapshots' option
Lars Hjemli [Mon, 24 Aug 2009 06:00:37 +0000 (08:00 +0200)]
cgitrc.5.txt: fix description and markup for 'snapshots' option

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.css: make the blob display in tree view a bit prettier
Lars Hjemli [Fri, 21 Aug 2009 12:37:50 +0000 (14:37 +0200)]
cgit.css: make the blob display in tree view a bit prettier

Adding some padding to the linenumbers while right-aligning them and
removing the background color makes the page more readable.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoRename "linenumbers" to "enable-tree-linenumbers", change default to "1"
Lars Hjemli [Fri, 21 Aug 2009 12:26:52 +0000 (14:26 +0200)]
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>
15 years agoAdd 'linenumbers' config option
Florian Pritz [Sun, 9 Aug 2009 20:42:45 +0000 (20:42 +0000)]
Add 'linenumbers' config option

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-tree.c: show line numbers when highlighting
Florian Pritz [Sun, 9 Aug 2009 13:43:18 +0000 (13:43 +0000)]
ui-tree.c: show line numbers when highlighting

When source-filter is enabled, cgit currently will not display
linenumbers in the tree view. This patch restores the linenumber
function.

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoscan-tree: split the pw_gecos field at the ',' to get the real name
Stefan Naewe [Thu, 20 Aug 2009 06:24:51 +0000 (08:24 +0200)]
scan-tree: split the pw_gecos field at the ',' to get the real name

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agocgit.c: fix caching keyed on PATH_INFO with no QUERY_STRING
Lars Hjemli [Thu, 20 Aug 2009 08:07:51 +0000 (10:07 +0200)]
cgit.c: fix caching keyed on PATH_INFO with no QUERY_STRING

When generating a hash for caching, ctx.qry.raw is used as key. And
since cgit_parse_url() zero-terminates it's argument (after the repo
path), ctx.qry.raw must xstrdup(ctx.qry.url).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoAdd and use a common readfile() function
Lars Hjemli [Tue, 18 Aug 2009 15:17:41 +0000 (17:17 +0200)]
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>
15 years agoMerge branch 'stable'
Lars Hjemli [Tue, 18 Aug 2009 15:21:52 +0000 (17:21 +0200)]
Merge branch 'stable'

15 years agotruncate buffer before reading empty files
Simon Arlott [Sat, 7 Mar 2009 00:06:24 +0000 (00:06 +0000)]
truncate buffer before reading empty files

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>
15 years agoMerge branch 'stable'
Lars Hjemli [Tue, 18 Aug 2009 11:14:11 +0000 (13:14 +0200)]
Merge branch 'stable'

15 years agoui-shared: don't print header <img/> if there isn't a logo defined
Matthew Metnetsky [Tue, 30 Jun 2009 01:27:51 +0000 (21:27 -0400)]
ui-shared: don't print header <img/> if there isn't a logo defined

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoMerge branch 'stable'
Lars Hjemli [Mon, 17 Aug 2009 08:17:23 +0000 (10:17 +0200)]
Merge branch 'stable'

15 years agocgit.c: do not segfault on unexpected query-string format
Lars Hjemli [Mon, 17 Aug 2009 07:05:13 +0000 (09:05 +0200)]
cgit.c: do not segfault on unexpected query-string format

The querystring_cb() function will be invoked with a NULL value when
the querystring contains a name not followed by a '='. Such a value
used to cause a segfault, which this patch fixes.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-tag.c: do not segfault when id is missing from query-string
Lars Hjemli [Mon, 17 Aug 2009 07:19:05 +0000 (09:19 +0200)]
ui-tag.c: do not segfault when id is missing from query-string

The purpose of the tag page is to print info about a specific tag,
but if no tag was specified on the query-string cgit used to segfault.

With this patch, cgit will fallback to the value of the 'h' parameter
instead (which is never NULL due to prepare_repo_cmd() in cgit.c).

It will now also verify that the specified tagname is in fact a valid
ref in the 'refs/tags/' namespace, i.e. specifying 'id=master' will
trigger a 'Bad tag reference' error.

Noticed-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-log.c: handle lightweight tags when printing commit decorations
Lars Hjemli [Sun, 16 Aug 2009 17:52:27 +0000 (19:52 +0200)]
ui-log.c: handle lightweight tags when printing commit decorations

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years agoui-refs.c: improve handling of lightweight tags
Stefan Bühler [Sun, 16 Aug 2009 17:35:18 +0000 (19:35 +0200)]
ui-refs.c: improve handling of lightweight tags

When a lightweight tag is referencing a commit object, cgit now uses
the commit date when comparing tag age. Also, the commitdate and author
info is printed in the refs view, making lightweight tags appear similar
to annotated tags.

Signed-off-by: Stefan Bühler <lighttpd@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>