summaryrefslogtreecommitdiffstatshomepage
path: root/ui-diff.c
Commit message (Expand)AuthorAge
* diff: move layout to page functionJohn Keeping2015-08-14
* log: allow users to follow a fileJohn Keeping2015-08-12
* Avoid signed bitfieldsJohn Keeping2015-03-09
* Avoid non-ANSI function declarationsJohn Keeping2015-03-09
* ui-diff: don't link to single file diff statJohn Keeping2014-12-30
* ui-diff: add "stat only" diff typeJohn Keeping2014-12-13
* Change "ss" diff flag to an enumJohn Keeping2014-12-13
* ui-shared: remove toggle_ssdiff arg to cgit_diff_link()John Keeping2014-12-13
* Switch to exclusively using global ctxLukas Fleischer2014-01-17
* Update copyright informationLukas Fleischer2014-01-08
* ui-diff: Use diff_tree_sha1() for raw diff formattingLukas Fleischer2013-09-14
* ui-diff: Check the return value of get_sha1()Lukas Fleischer2013-08-20
* Allow for creating raw diffs with cgit_print_diff()Lukas Fleischer2013-08-16
* Convert cgit_print_error to a variadic functionJohn Keeping2013-04-08
* Always #include corresponding .h in .c filesJohn Keeping2013-04-08
* Mark several functions/variables staticLukas Fleischer2013-03-04
* White space around control verbs.Jason A. Donenfeld2013-03-04
* Format git diff headers correctly when adding or removing files.Michael Halstead2012-11-15
* ui-ssdiff.c: set correct diffmode in "control panel"Tim Chen2012-01-03
* Merge branch 'stable'Lars Hjemli2012-01-03
|\
| * Fix diff mode switching when side-by-side-diffs=1Tim Chen2012-01-03
* | Merge branch 'stable'Lars Hjemli2011-07-22
|\|
| * Fix potential XSS vulnerability in rename hintLukas Fleischer2011-07-22
* | Merge branch 'lh/panel'Lars Hjemli2011-05-23
|\ \ | |/ |/|
| * ui-diff.c: create a control panel for diff optionsLars Hjemli2011-03-06
* | Avoid null pointer dereference in cgit_print_diff().Lukas Fleischer2011-05-23
|/
* ui-diff.c: avoid html injectionLukasz Janyst2011-03-05
* ssdiff: anchors for ssdiffBernhard Reutner-Fischer2011-02-19
* fix errors in printf-style format stringsMark Lodato2010-09-04
* ui-diff: Add link to ignore/show whitespace changes in diffsJohan Herland2010-07-18
* Add URL parameter 'ignorews' for optionally ignoring whitespace in diffsJohan Herland2010-07-18
* ui-diff: Add links to increase/decrease number of context lines in diffsJohan Herland2010-06-19
* Add URL parameter 'context' for changing the number of context lines in diffsJohan Herland2010-06-19
* ui-diff: Teach diffstat to obey path limitJohan Herland2010-06-19
* Fixed side-by-side diff bugs related to binary diff and more.Ragnar Ouchterlony2009-09-16
* Polishing of how the side-by-side diff looks.Ragnar Ouchterlony2009-09-16
* Add possibility to switch between unidiff and side-by-side-diff.Ragnar Ouchterlony2009-09-16
* First version of side-by-side diff.Ragnar Ouchterlony2009-09-16
* Handle binary files in diffsLars Hjemli2009-01-31
* ui-diff: make diffstat header a link to the full diffLars Hjemli2008-09-23
* ui-diff: fix links from diffstatLars Hjemli2008-09-23
* Include commit-id in link from diff-statLars Hjemli2008-05-18
* ui-diff: remove test on object typeLars Hjemli2008-04-24
* Integrate diffstat with diffLars Hjemli2008-04-24
* Add ui-shared.hLars Hjemli2008-03-24
* Introduce html.hLars Hjemli2008-03-18
* Introduce struct cgit_contextLars Hjemli2008-02-16
* Fix html error detected by test-suiteLars Hjemli2007-11-11
* ui-diff: add links to pre- and postversion of blobsLars Hjemli2007-10-01
* Add prefix parameter to cgit_print_diff()Lars Hjemli2007-10-01
ss="w"> mode1); if (!subproject) { abbrev1 = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV)); abbrev2 = xstrdup(find_unique_abbrev(sha2, DEFAULT_ABBREV)); htmlf("index %s..%s", abbrev1, abbrev2); free(abbrev1); free(abbrev2); if (mode1 != 0 && mode2 != 0) { htmlf(" %.6o", mode1); if (mode2 != mode1) htmlf("..%.6o", mode2); } htmlf("\n--- a/%s\n", path1); htmlf("+++ b/%s\n", path2); } } static void filepair_cb(struct diff_filepair *pair) { unsigned long old_size = 0; unsigned long new_size = 0; int binary = 0; header(pair->one->sha1, pair->one->path, pair->one->mode, pair->two->sha1, pair->two->path, pair->two->mode); if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) { if (S_ISGITLINK(pair->one->mode)) print_line(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52); if (S_ISGITLINK(pair->two->mode)) print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); return; } if (cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, &new_size, &binary, 0, 0, print_line)) html("Error running diff"); if (binary) html("Binary files differ\n"); } void cgit_print_patch(char *hex, const char *prefix) { struct commit *commit; struct commitinfo *info; unsigned char sha1[20], old_sha1[20]; char *patchname; if (!hex) hex = ctx.qry.head; if (get_sha1(hex, sha1)) { cgit_print_error(fmt("Bad object id: %s", hex)); return; } commit = lookup_commit_reference(sha1); if (!commit) { cgit_print_error(fmt("Bad commit reference: %s", hex)); return; } info = cgit_parse_commit(commit); if (commit->parents && commit->parents->item) hashcpy(old_sha1, commit->parents->item->object.sha1); else hashclr(old_sha1); patchname = fmt("%s.patch", sha1_to_hex(sha1)); ctx.page.mimetype = "text/plain"; ctx.page.filename = patchname; cgit_print_http_headers(&ctx); htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); htmlf("From: %s", info->author); if (!ctx.cfg.noplainemail) { htmlf(" %s", info->author_email); } html("\n"); html("Date: "); cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); htmlf("Subject: %s\n\n", info->subject); if (info->msg && *info->msg) { htmlf("%s", info->msg); if (info->msg[strlen(info->msg) - 1] != '\n') html("\n"); } html("---\n"); if (prefix) htmlf("(limited to '%s')\n\n", prefix); cgit_diff_tree(old_sha1, sha1, filepair_cb, prefix, 0); html("--\n"); htmlf("cgit %s\n", CGIT_VERSION); cgit_free_commitinfo(info); }