Commit Graph

738 Commits (3516502aa0df95ecc241caa30161741f59e4e600)
 

Author SHA1 Message Date
Lars Hjemli 71d3ca75d1 Merge branch 'stable' 14 years ago
Daniel Milde 9bd3a7b1ea Clear the whole context
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
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>
14 years ago
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>
15 years ago
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>
15 years ago
Mark Lodato 6c1a736455 ui-plain: print directory listings
When a user requests a plain view of a tree (as opposed to a blob),
print out a directory listing rather than giving a 404 Not Found.

Also, fix a segfault when ctx->qry.path is NULL - i.e, when /plain is
requested without a path.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
15 years ago
Mark Lodato 74ebf82229 ui-plain: more efficient walk_tree()
Git's read_tree_recursive() already filters out the objects by pathname,
so we only have to compare baselen to the expected.  That is, no string
matching is required.

Additionally, if the requested path is a directory, the old code would
walk through all of its immediate children.  This is not necessary, this
so we no longer do that.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
15 years ago
Mark Lodato 89082346d5 ui-plain: remove unused curr_rev variable
Signed-off-by: Mark Lodato <lodatom@gmail.com>
15 years ago
Lars Hjemli 547a64fbd6 Merge branch 'stable' 15 years ago
Lars Hjemli c86e206a97 CGIT 0.8.3.1
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Martins Polakovs 24538b0727 Fix segfault on ppc when browsing tree 15 years ago
Andreas Wiese 0642435fed Add .tar.xz-snapshot support
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 4e75d7c9b9 Merge branch 'lh/remote-branches' 15 years ago
Lars Hjemli f4f6210b4f Merge branch 'ro/ssdiff' 15 years ago
Lars Hjemli 57bb4fdb84 Merge branch 'master' of http://op-co.de/cgit 15 years ago
Lars Hjemli 5c34d96f7e Merge branch 'stable' 15 years ago
Sami Kyöstilä f2bf0a0528 Don't crash when a repo-specific readme file is used
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
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>
15 years ago
Georg Lukas 545b5a5dca cgit.css: highlight directories in tree 15 years ago
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>
15 years ago
Lars Hjemli 41934a3222 Add support for remote branches
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli e633ccf714 Merge branch 'stable' 15 years ago
Lars Hjemli 21f67e7d82 shared.c: return original errno
Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
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>
15 years ago
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>
15 years ago
Lars Hjemli 4b1fee00dd Merge branch 'stable' 15 years ago
Rys Sommefeldt 8cfe4897f0 Close fd on error in readfile()
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Danijel Tašov e34a3b5adc Nov is the correct abbreviation 15 years ago
Lars Hjemli 13032727ff ui-shared.c: prettify download links when generated from tag page
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 322a4bc309 ui-tag: make output more similar to commit view
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Alexey Nezhdanov 8cdccac758 ui-tag: add snapshot links
Signed-off-by: Alexey Nezhdanov <snakeru@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
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>
15 years ago
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>
15 years ago
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>
15 years ago
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>
15 years ago
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>
15 years ago
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>
15 years ago
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>
15 years ago
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>
15 years ago
Lars Hjemli 27479ac54c CGIT 0.8.3
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 33998c51be Merge branch 'stable' 15 years ago
Lars Hjemli f92ca06e4b CGIT 0.8.2.2
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 92f6940975 Merge branch 'lh/repo-scan' 15 years ago
Lars Hjemli 5f12e45fe3 Merge branch 'fp/linenumbers' 15 years ago
Lars Hjemli 45c49d6cf4 Use GIT-1.6.4.3
Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
15 years ago
Lars Hjemli 670f990979 Merge branch 'stable' 15 years ago
Lars Hjemli b507252b46 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 ago
Lars Hjemli ee554849ac 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 ago
Lars Hjemli 588fb8efc6 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 ago
Lars Hjemli b47b7bd1d0 Add and use cgit_find_stats_periodname() in print_repo()
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago