about summary refs log tree commit diff stats
path: root/ui-diff.c
Commit message (Collapse)AuthorAge
* Convert cgit_print_error to a variadic functionJohn Keeping2013-04-08
| | | | | | | | | This removes many uses of "fmt" which uses a fixed size static pool of fixed size buffers. Instead of relying on these, we now pass around argument lists for as long as possible before using a strbuf to render content of an arbitrary size. Signed-off-by: John Keeping <john@keeping.me.uk>
* Always #include corresponding .h in .c filesJohn Keeping2013-04-08
| | | | | | | | | | | | While doing this, remove declarations from header files where the corresponding definition is declared "static" in order to avoid build errors. Also re-order existing headers in ui-*.c so that the file-specific header always comes immediately after "cgit.h", helping with future consistency. Signed-off-by: John Keeping <john@keeping.me.uk>
* Mark several functions/variables staticLukas Fleischer2013-03-04
| | | | | | Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* White space around control verbs.Jason A. Donenfeld2013-03-04
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Format git diff headers correctly when adding or removing files.Michael Halstead2012-11-15
| | | | | | Copying the output of cgit and using it in patches now works when adding files to or removing files from the repository. This is helpful for people who use cgit in their patch workflow.
* ui-ssdiff.c: set correct diffmode in "control panel"Tim Chen2012-01-03
| | | | | | When side-by-side-diffs=1 was set in cgitrc, specifying 'ss=0' in the querystring would not set the 'unified' option as active in the dropdown box used to select diffmode.
* Merge branch 'stable'Lars Hjemli2012-01-03
|\
| * Fix diff mode switching when side-by-side-diffs=1Tim Chen2012-01-03
| | | | | | | | | | | | | | When side-by-side-diffs=1 was set in cgitrc, specyfing 'ss=0' in the query- string would not switch to unified diffs. This patch fixes the issue by introducing a separate variable to track the occurrence of "ss" in the querystring.
* | Merge branch 'stable'Lars Hjemli2011-07-22
|\|
| * Fix potential XSS vulnerability in rename hintLukas Fleischer2011-07-22
| | | | | | | | | | | | | | | | | | The file name displayed in the rename hint should be escaped to avoid XSS. Note that this vulnerability is only applicable when an attacker has gained push access to the repository. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Merge branch 'lh/panel'Lars Hjemli2011-05-23
|\ \ | |/ |/|
| * ui-diff.c: create a control panel for diff optionsLars Hjemli2011-03-06
| | | | | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Avoid null pointer dereference in cgit_print_diff().Lukas Fleischer2011-05-23
|/ | | | | | | | | | When calling cgit_print_diff() with a bad new_rev and a NULL old_rev, checking for new_rev's parent commit will result in a null pointer dereference. Returning on an invalid commit before dereferencing fixes this. Spotted with clang-analyzer. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-diff.c: avoid html injectionLukasz Janyst2011-03-05
| | | | | | | | When path-filtering was used in commit-view, the path filter was included without proper html escaping. This patch closes the hole. Signed-off-by: Lukasz Janyst <ljanyst@cern.ch> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ssdiff: anchors for ssdiffBernhard Reutner-Fischer2011-02-19
| | | | | | | Emit anchors to the respective revisions in side-by-side diff view Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* fix errors in printf-style format stringsMark Lodato2010-09-04
| | | | | | | | | | | | | | | | | There were many places where the arguments to a printf-like function did not match the format string. Mostly, these were a missing 'l' flag, but there were three exceptions: - In ui-stats.c, a size_t argument must be printed. C99 has the "%zu" flag for this purpose, but not all compilers support this. Therefore, we mimic what git does - use a NO_C99_FORMAT Makefile variable. - In ui-stats.c, cgit_print_error() was called with a pointer instead of a character. - In ui-log.c, the "columns" argument was never used. Signed-off-by: Mark Lodato <lodatom@gmail.com>
* ui-diff: Add link to ignore/show whitespace changes in diffsJohan Herland2010-07-18
| | | | | | | | | | Add a link to the "Diffstat" line to ignore/show whitespace changes in the generated diff. To support this, cgit_commit_link() and cgit_diff_link() has learned to preserve the ctx.qry.ignorews variable. Signed-off-by: Johan Herland <johan@herland.net>
* Add URL parameter 'ignorews' for optionally ignoring whitespace in diffsJohan Herland2010-07-18
| | | | | | | | 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>
* ui-diff: Add links to increase/decrease number of context lines in diffsJohan Herland2010-06-19
| | | | | | | | | | | 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>
* Add URL parameter 'context' for changing the number of context lines in diffsJohan Herland2010-06-19
| | | | | | | | 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>
* ui-diff: Teach diffstat to obey path limitJohan Herland2010-06-19
| | | | | | | 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>
* Fixed side-by-side diff bugs related to binary diff and more.Ragnar Ouchterlony2009-09-16
| | | | | | | | | | | | 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>
* Polishing of how the side-by-side diff looks.Ragnar Ouchterlony2009-09-16
| | | | | | | | | | | 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>
* Add possibility to switch between unidiff and side-by-side-diff.Ragnar Ouchterlony2009-09-16
| | | | | | | | | | | | | | | | 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>
* First version of side-by-side diff.Ragnar Ouchterlony2009-09-16
| | | | | | | | | 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>
* Handle binary files in diffsLars Hjemli2009-01-31
| | | | | | | This teaches all diff-related operations (i.e. ui-log, ui-diff and ui-patch) how to handle binary files. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-diff: make diffstat header a link to the full diffLars Hjemli2008-09-23
| | | | | | | | When printing a path-filtered diff it wasn't obvious how to get back to the full diff (clicking the 'diff' tab would do this). Making the diffstat heading into a link seems to improve the usability. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-diff: fix links from diffstatLars Hjemli2008-09-23
| | | | | | | | | | | The links in the diffstat is supposed to work as a filter for the diff, but this only worked when a single rev was supplied, i.e. the filtered diff was always against the parent of the specified rev. With this patch it is now possible to use the diffstat as a 'filter menu' for urls like http://hjemli.net/git/cgit/diff/?id=v0.7.2&id2=v0.7.1 Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Include commit-id in link from diff-statLars Hjemli2008-05-18
| | | | | | | This fixes a regression created by fe1230dece81450004d02fa8a470f8dab8f7fdd9, and modifies a test to avoid future regressions. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-diff: remove test on object typeLars Hjemli2008-04-24
| | | | | | | By removing the test for commit objects it's now possible to specify a tag name for the id query-string parameter (it already worked for id2). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Integrate diffstat with diffLars Hjemli2008-04-24
| | | | | | | | This creates a generic diffstat function in ui-diff, which then is invoked from cgit_print_diff with the result that both commit and diff- view gets a diffstat. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add ui-shared.hLars Hjemli2008-03-24
| | | | | | | This is finally a proper headerfile for the shared ui-functions which used to reside in cgit.h Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Introduce html.hLars Hjemli2008-03-18
| | | | | | | | All html-functions can be quite easily separated from the rest of cgit, so lets do it; the only issue was html_filemode which uses some git-defined macros so the function is moved into ui-shared.c::cgit_print_filemode(). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Introduce struct cgit_contextLars Hjemli2008-02-16
| | | | | | | | | This struct will hold all the cgit runtime information currently found in a multitude of global variables. The first cleanup removes all querystring-related variables. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Fix html error detected by test-suiteLars Hjemli2007-11-11
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-diff: add links to pre- and postversion of blobsLars Hjemli2007-10-01
| | | | | | Each diff header now links to the old and new version of each file Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add prefix parameter to cgit_print_diff()Lars Hjemli2007-10-01
| | | | | | This allows a diff to be restricted to the path prefix specified in the url. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add prefix parameter to cgit_diff_tree()Lars Hjemli2007-10-01
| | | | | | This paramter can be used to restrict a diff to the specified path prefix. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Merge branch 'jo/dirlink'Lars Hjemli2007-09-03
|\ | | | | | | | | | | | | | | | | | | | | * jo/dirlink: Rename dirlink to gitlink. Conflicts: ui-tree.c Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * Rename dirlink to gitlink.Jeffrey C. Ollie2007-06-04
| | | | | | | | | | | | | | Git changed from dirlink to gitlink in 302b9282c9ddfcc704ca759bdc98c1d5f75eba2f. Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
* | Add cgit_diff_link()Lars Hjemli2007-06-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new function used to generate links to the diff page and uses it everywhere such links appear (expect for single files in the diffstat displayed on the commit page: this is now a link to the tree page). The updated diff-page now expects zero, one or two revision specifiers, in parameters head, id and id2. Id defaults to head unless otherwise specified, while head (as usual) defaults to repo.defbranch. If id2 isn't specified, it defaults to the first parent of id1. The most important change is of course that now all repo pages (summary, log, tree, commit and diff) has support for passing on the current branch and revision, i.e. the road is now open for a 'static' menu with links to all of these pages. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | ui-diff: close td/tr/table properlyLars Hjemli2007-06-06
| | | | | | | | | | | | | | | | The previous commit fixed the diff-view when two trees where specified on the querystring (sha1/sha2) but made the generated html invalid when only a commit sha1 is specified. This fixes it. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | ui-diff: emit table/tr/td at better locationsLars Hjemli2007-06-05
|/ | | | | | | | | | This fixes a bug which made the diff-link for each parent of a commit output a diff without correct styles. It also adds an error-message if the head commit specified on the querystring isn't a valid commit object. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Fixed unexpected tags in html output.Ondrej Jirman2007-05-31
| | | | | | At least those that were catched by tidy. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Don't die when diffing trees with subprojectsLars Hjemli2007-05-16
| | | | | | | | | The subprojects needs special handling, since they refer to objects which normally won't exist in the refering repository. Fix some extended header bugs and missing features while at it. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add support for commitdiff via h parameterLars Hjemli2007-05-16
| | | | | | | | | The commitdiff will be generated against the first parent, and the diff page also gets the benefit of repo.defbranch. Cleaned up some bad whitespace in cgit.h while at it. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-diff: show /dev/null as filename for add/deleteLars Hjemli2007-05-15
| | | | | | | The diff headers showed an invalid filename when a patch created or deleted a file. Fix it. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* cgit.css: try to make diffs look a little bit nicerLars Hjemli2007-05-14
| | | | | | This makes the diffview look more like 'git-diff' in a terminal. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add commitdiff between commit and each of it's parentLars Hjemli2007-05-13
| | | | | | | | | | A link is added next to each parent of a commit, leading to the new diff-functionality in ui-diff.c. Also added support for a path-parameter to filelevel diffs accessed via the diffstat. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Simplify ui-diff.c using the new file-level diff interfaceLars Hjemli2007-05-13
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>