Commit Graph

708 Commits (2cc8b99f083014c58d8937bfa4dcd2bc47cd7e58)
 

Author SHA1 Message Date
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>
14 years ago
Johan Herland d20313e3da ui-diff: Add links to increase/decrease number of context lines in diffs
Add two links to the "Diffstat" line to show more/less context lines in the
generated diff.

To support this, cgit_commit_link() and cgit_diff_link() has learned to
preserve the ctx.qry.context variable.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
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>
14 years ago
Lars Hjemli a2cbd3c30b ui-shared.c: path-limit style nitpick
This subjectively makes the path-limit bar less visually intrusive.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Johan Herland afc40725c1 ui-log: Preserve path limit in outgoing links
This allows navigation through the 'log' page/command without losing the
active path limit.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Johan Herland 7fdff24604 ui-shared: Preserve path limit in "tab bar" links
When using the "tab bar" in the pageheader to navigate between pages, any
path limit in effect on the current page is forgotten in the link to the
target page, even if the target page can interpret and use the path limit
constructively.

Instead, preserve the current page's path limit in the "tab bar" links to
other pages, where the path limit is useful to the target page.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Johan Herland 685872b770 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 ago
Johan Herland 34c2331d2c 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 ago
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>
14 years ago
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>
14 years ago
Johan Herland c46e468dd2 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 ago
Johan Herland 48f7b982d3 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 ago
Johan Herland 24fd7e54c8 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 ago
Johan Herland c93ef96aaf 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 ago
Johan Herland c8e3295469 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 ago
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>
14 years ago
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>
14 years ago
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>
14 years ago
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>
14 years ago
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>
14 years ago
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>
15 years ago
Lars Hjemli c151ce61d8 Use GIT-1.7.0
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 067c180435 Merge branch 'html-updates' of git://github.com/MarkLodato/cgit 15 years ago
Lars Hjemli 71d3ca75d1 Merge branch 'stable' 15 years ago
Daniel Milde 9bd3a7b1ea Clear the whole context
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 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>
15 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
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