Commit Graph

693 Commits

Author SHA1 Message Date
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
Johan Herland
0e34c6d1ef 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>
2010-06-19 10:40:22 +02:00
Johan Herland
c3f23d4571 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>
2010-06-19 10:40:21 +02:00
Johan Herland
026980c270 Remove unused variable in shared.c
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-06-19 10:40:21 +02:00
Johan Herland
9ce5d05f86 Fix small typo in cgitrc example
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-06-19 10:40:21 +02:00
Lars Hjemli
ff3a3b4e2b 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>
2010-02-28 22:18:00 +01:00
Lars Hjemli
c151ce61d8 Use GIT-1.7.0
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-02-27 13:39:53 +01:00
Lars Hjemli
067c180435 Merge branch 'html-updates' of git://github.com/MarkLodato/cgit 2010-02-27 13:20:27 +01:00
Lars Hjemli
71d3ca75d1 Merge branch 'stable' 2010-02-27 12:53:27 +01:00
Daniel Milde
9bd3a7b1ea Clear the whole context
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-02-27 12:52:12 +01:00
Florian Pritz
8d946079c5 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>
2010-02-27 12:47:57 +01:00
Mark Lodato
a2c6355f9f 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>
2010-02-09 10:12:43 -05:00
Mark Lodato
8aab27f24d 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>
2010-02-08 23:04:41 -05:00
Lars Hjemli
547a64fbd6 Merge branch 'stable' 2009-12-12 12:09:47 +01:00
Lars Hjemli
c86e206a97 CGIT 0.8.3.1
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-12-12 12:08:14 +01:00
Martins Polakovs
24538b0727 Fix segfault on ppc when browsing tree 2009-12-12 11:56:25 +01:00
Andreas Wiese
0642435fed Add .tar.xz-snapshot support
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-12-08 22:18:11 +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
Lars Hjemli
57bb4fdb84 Merge branch 'master' of http://op-co.de/cgit 2009-12-08 18:31:07 +01:00
Lars Hjemli
5c34d96f7e Merge branch 'stable' 2009-12-08 18:30:02 +01:00
Sami Kyöstilä
f2bf0a0528 Don't crash when a repo-specific readme file is used
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-12-08 18:25:40 +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
Georg Lukas
545b5a5dca cgit.css: highlight directories in tree 2009-11-28 03:07:34 +01:00
Georg Lukas
56522ebe13 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>
2009-11-19 12:14:45 +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
Lars Hjemli
e633ccf714 Merge branch 'stable' 2009-11-07 18:16:50 +01:00
Lars Hjemli
21f67e7d82 shared.c: return original errno
Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-11-07 18:08:30 +01:00
Mikhail Gusarov
59310ab102 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>
2009-11-07 16:23:19 +01:00
Ragnar Ouchterlony
735e15e38a 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>
2009-11-07 15:37:11 +01:00
Lars Hjemli
4b1fee00dd Merge branch 'stable' 2009-11-07 15:35:36 +01:00
Rys Sommefeldt
8cfe4897f0 Close fd on error in readfile()
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-11-07 15:34:18 +01:00
Danijel Tašov
e34a3b5adc Nov is the correct abbreviation 2009-11-07 15:29:54 +01:00
Lars Hjemli
13032727ff ui-shared.c: prettify download links when generated from tag page
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-10-16 02:03:32 +02:00
Lars Hjemli
322a4bc309 ui-tag: make output more similar to commit view
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-10-06 20:33:04 +02:00
Alexey Nezhdanov
8cdccac758 ui-tag: add snapshot links
Signed-off-by: Alexey Nezhdanov <snakeru@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-10-06 19:26:06 +02:00
Stefan Bühler
121898e73d 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>
2009-10-06 18:56:43 +02:00
Geoff Johnstone
9735835c0e Fix repolist search links with virtual root
Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-09-20 13:07:57 +02:00
Ragnar Ouchterlony
4a198e4b8e 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>
2009-09-16 20:17:56 +02:00
Ragnar Ouchterlony
207cc34711 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>
2009-09-16 20:17:56 +02: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
Ragnar Ouchterlony
40e174d536 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>
2009-09-16 20:17:56 +02:00
Loui Chang
8071e18dcb 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>
2009-09-14 22:47:57 +02:00
Loui Chang
676d17b22f 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>
2009-09-14 22:47:57 +02:00
Lars Hjemli
27479ac54c CGIT 0.8.3
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-09-13 22:17:02 +02:00
Lars Hjemli
33998c51be Merge branch 'stable' 2009-09-13 22:15:38 +02:00
Lars Hjemli
f92ca06e4b CGIT 0.8.2.2
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-09-13 22:14:12 +02:00
Lars Hjemli
92f6940975 Merge branch 'lh/repo-scan' 2009-09-13 22:02:07 +02:00
Lars Hjemli
5f12e45fe3 Merge branch 'fp/linenumbers' 2009-09-13 22:01:52 +02:00
Lars Hjemli
45c49d6cf4 Use GIT-1.6.4.3
Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
2009-09-13 21:56:45 +02:00