aboutsummaryrefslogtreecommitdiffstats
path: root/ui-log.c
AgeCommit message (Collapse)AuthorFilesLines
2014-12-13ui-shared: remove toggle_ssdiff arg to cgit_commit_link()John Keeping1-2/+2
This argument is never used with a value other than zero, so remove it and simplify the code. Signed-off-by: John Keeping <john@keeping.me.uk>
2014-07-28git: update to v2.0.3John Keeping1-4/+2
This is slightly more involved than just bumping the version number because it pulls in a change to convert the commit buffer to a slab, removing the "buffer" field from "struct commit". All sites that access "commit->buffer" have been changed to use the new functions provided for this purpose. Signed-off-by: John Keeping <john@keeping.me.uk>
2014-06-28ui-log: ignore unhandled argumentsJohn Keeping1-3/+3
If you search for a bogus range string here: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/ Using something like "range" and "qwerty123456", it returns an "Internal Server Error" and the following in the logs: > [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] fatal: > ambiguous argument 'qwerty123456': unknown revision or path not in the > working tree., referer: > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ > [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] Use '--' to > separate paths from revisions, like this:, referer: > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ > [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] 'git <command> > [<revision>...] -- [<file>...]', referer: > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ > [Tue Jun 10 17:45:32 2014] [error] [client 172.21.1.6] Premature end > of script headers: cgit, referer: > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ The cache will kick in, so if you search for the same string again, it'll show an empty range, so you have to change the bogus strings each time. This is because we just pass the arguments straight to Git's revision parsing machinery which die()s if it cannot parse an argument, printing the above to stderr and exiting. The patch below makes it a bit friendlier by just ignoring unhandled arguments, but I can't see an easy way to report errors when we can't parse revision arguments without losing the flexibility of supporting all of the revision specifiers supported by Git. Reported-by: Konstantin Ryabitsev <mricon@kernel.org>
2014-06-28git: update for git 2.0Christian Hesse1-4/+4
prefixcmp() and suffixcmp() have been remove, functionality is now provided by starts_with() and ends_with(). Retrurn values have been changed, so instead of just renaming we have to fix logic. Everything else looks just fine.
2014-01-14filter: add page source to email filterJason A. Donenfeld1-1/+1
Since the email filter is called from lots of places, the script might benefit from knowing the origin. That way it can modify its contents and/or size depending. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2014-01-14filter: add support for email filterJason A. Donenfeld1-0/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2014-01-08Update copyright informationLukas Fleischer1-1/+1
* Name "cgit Development Team" as copyright holder to avoid listing every single developer. * Update copyright ranges. Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
2014-01-08ui-log.c: Several simplificationsLukas Fleischer1-19/+9
* Use argv_array_pushf() for inserting formatted strings. * Remove unneeded static strings. * Replace "if" by "else if" for readability and speed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2014-01-08Use argv_array in place of vectorLukas Fleischer1-19/+15
Instead of using our own vector implementation, use argv_array from Git which has been specifically designed for dynamic size argv arrays. Drop vector.h and vector.c which are no longer needed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-05-22ui-log: add <span/> around commit decorationsJohn Keeping1-0/+2
This helps projects that have a large number of tags to display them all using custom CSS. The default stylesheet has not been updated since what is useful for projects with a lot of tags is not the same as what is useful for projects with only a small number of decorations per commit. Suggested-by: Konstantin Ryabitsev <mricon@kernel.org> Signed-off-by: John Keeping <john@keeping.me.uk>
2013-04-08Do not load user or system gitconfig and gitattributesJason A. Donenfeld1-1/+0
While doing any kind of git loading, unset HOME variables and set NOSYSTEM variables so that cgit does not load any settings that a user may have set for his own /usr/bin/git usage. This fixes a fatal error introduced with git 1.8, whereupon git would fatally exit when failing to access particular files. The result of this is that only repo-local configuration files are accessed: zx2c4@thinkpad ~/Projects/cgit $ HOME=/root QUERY_STRING="url=foo/log" CGIT_CONFIG=tests/trash/cgitrc strace -e access ./cgit >/dev/null access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) access("repos/foo/.git/objects", X_OK) = 0 access("repos/foo/.git/refs", X_OK) = 0 access("repos/foo/.git/config", R_OK) = 0 access("repos/foo/.git/config", R_OK) = 0 access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0 access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0 access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0 access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0 +++ exited with 0 +++ Reported-by: Ferry Huberts <ferry.huberts@pelagic.nl> Tested-by: Jason A. Donenfeld <Jason@zx2c4.com> Tested-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-04-08use struct strbuf instead of static buffersJohn Keeping1-11/+22
Use "struct strbuf" from Git to remove the limit on file path length. Notes on scan-tree: This is slightly involved since I decided to pass the strbuf into add_repo() and modify if whenever a new file name is required, which should avoid any extra allocations within that function. The pattern there is to append the filename, use it and then reset the buffer to its original length (retaining a trailing '/'). Notes on ui-snapshot: Since write_archive modifies the argv array passed to it we copy the argv_array values into a new array of char* and then free the original argv_array structure and the new array without worrying about what the values now look like. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-04-08Always #include corresponding .h in .c filesJohn Keeping1-0/+1
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>
2013-04-08Update git to v1.8.2.1John Keeping1-3/+3
This requires a small change to how we handle notes, but otherwise just works. Note that we can't use anything from v1.8.0 until v1.8.2.1 because some of the symbols that we need for graph drawing were made private in v1.8.0 and this was not reverted until v1.8.2.1. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-20Convert pager navigation into a unordered listLukas Fleischer1-3/+6
It is common practice and semantically appropriate to use unordered lists for long navigation lists. This also fixes the layout of very long pager navigations in Webkit-based browsers. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-20Fix colspan valuesLukas Fleischer1-7/+7
This fixes a couple of minor oversights in previous commits and adjusts all cells using colspan to use the correct width. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-05Mark several functions/variables staticLukas Fleischer1-3/+3
Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2012-10-17ui-log: Add "commit-sort" option for controlling commit orderingTobias Bieniek1-1/+9
This makes it possible to use strict commit date ordering or strict topological ordering by passing the corresponding flags to "git log". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-01-03Merge branch 'stable'Lars Hjemli1-0/+3
2012-01-03ui-log.c: do not show remote heads if enable-remote-branches=0Georg Müller1-0/+3
If remote branches are not enabled, the branches are still listed in the log view. This patch removes them if enable-remote-branches=0.
2011-06-02Merge branch 'stable'Lars Hjemli1-9/+0
2011-06-02ui-log.c: do not link from age columnLars Hjemli1-9/+0
The link url wasn't properly escaped, and since the link was identical to the one used on the commit message it didn't serve any special purpose. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2011-03-26make enable-log-linecount independent of -filecountJulius Plenz1-15/+14
You should be able to independently switch file and line count on and off. This patch makes the code work like the documentation suggests: no dependency for line counts to be displayed only when file counts are. Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-16ui-log: Move 'Age' column when commit graph is presentJohan Herland1-12/+30
When the commit graph is present, we prefer to draw it along the left edge, and moving the 'Age' column to the right of the 'Author' column, like in gitk. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-16ui-log: Line-wrap long commit subjects when showmsg is enabledJohan Herland1-5/+30
When showmsg is disabled ui-log truncates long commit subjects. This is good. However, the same is not desirable when showmsg is enabled, since you then end up with a truncated commit subject followed by the rest of the commit message below. Instead, when showmsg is enabled (and we're using all this space to display the entire commit message, anyway), line-wrap the commit subject instead of truncating it. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-16ui-log: Colorize commit graphJohan Herland1-0/+19
Use the existing coloring logic in Git's graph code to color the lines between commits in the commit graph. Whereas Git normally uses ANSI color escapes to produce colors, we here use graph_set_column_colors() to replace those with HTML color escapes, that embed the graph lines in <span> tags that apply the desired color using CSS. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-16ui-log: Implement support for commit graphsJohan Herland1-21/+82
Teach CGit to print an ASCII art commit graph to the left of the commit message, similar to 'git log --graph'. The graph adds extra lines (table rows) to the log when needed to add/remove/shuffle edges in the graph. When 'showmsg' is enabled, the graph is automatically padded to account for the extra lines added by the commit message/notes. This feature is controlled by a new config variable: "enable-commit-graph" (disabled by default), and individual repos can control it by setting "repo.enable-commit-graph". Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-16ui-log: Change display of full commit messages (and notes)Johan Herland1-13/+17
When showmsg is enabled, ui-log (in addition to the table row containing the details of the current commit) adds a second table row containing the remainder of the commit message, and yet another table row containing the commit notes (if any). The vertical margins between commit subject, commit message and commit notes are controlled by CSS. In preparation for the commit graph (which will be printed to the left of the commit message/notes) we need to eliminate these vertical margins (as they would produce ugly gaps in the commit graph) and instead achieve them by adding newlines to the commit message/notes. Furthermore, we can no longer print the "Notes:" header in the "Age" column, since the graph will be drawn between the "Age" column and the "Commit message" column. This patch therefore prepares the commit message and commit notes in a single buffer (properly formatting the notes using the NOTES_SHOW_HEADER and NOTES_INDENT flags to format_note()), and then prints the entire buffer into a single table row. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-10ui-log.c: improve handling of range-search argumentLars Hjemli1-11/+60
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-10ui-log: Prevent crash when given empty range searchJohan Herland1-1/+1
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-11-09ui-log: Fix filecount/linecount when path limit is in effectJohan Herland1-1/+1
When using ui-log with path limits, the listing of commits enables parent rewriting in Git's internal log machinery. This did not work well together with cgit_diff_commit() which is used to generate the filecount and linecount numbers for each commit in the log view. cgit_diff_commit() would operate without any path limits, and would therefore process the full diff between the commits shown (which, because of parent rewriting, is not the same as processing the diff for the commit itself). Additionally, the bottom commit in the log view would (again, because of parent rewriting) have zero parents, causing us to process the entire diff between the empty tree and that commit. Since path limits were not in effect, this would (in large projects) reports thousands of files and millions of lines changed in that bottom commit. This patch fixes the issue by applying the same path limit to cgit_diff_commit() as is applied to the rest of the log view. The result is that the filecount/linecount now only reflects the diff as it pertains to the given path limit. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-09-04fix errors in printf-style format stringsMark Lodato1-2/+1
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>
2010-08-22Use GIT-1.7.2.2Lars Hjemli1-1/+1
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-04ui-log: Display git notes when presentJeff Smith1-0/+12
Signed-off-by: Jeff Smith <whydoubt@yahoo.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-07-18Merge branch 'jh/ignorews'Lars Hjemli1-1/+2
2010-07-18Add URL parameter 'ignorews' for optionally ignoring whitespace in diffsJohan Herland1-1/+2
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>
2010-06-22Merge branch 'lh/range-search'Lars Hjemli1-4/+7
2010-06-19ui-log.c: allow commit range as search expressionLars Hjemli1-4/+7
Inspired-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-06-19Add URL parameter 'context' for changing the number of context lines in diffsJohan Herland1-1/+1
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>
2010-06-19ui-log: Preserve path limit in outgoing linksJohan Herland1-12/+15
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>
2010-06-19ui-commit: Preserve path limit in links to commit pageJohan Herland1-2/+2
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>
2009-09-16Add possibility to switch between unidiff and side-by-side-diff.Ragnar Ouchterlony1-2/+2
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-13Use GIT-1.6.4.3Lars Hjemli1-1/+1
Signed-off-by: Lars Hjemli <larsh@slackbox.hjemli.net>
2009-08-16ui-log.c: handle lightweight tags when printing commit decorationsLars Hjemli1-0/+4
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-01-31Handle binary files in diffsLars Hjemli1-1/+6
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>
2009-01-11Change toggle to more meaningful termJustin Waters1-1/+2
In the log interface, there is a toggle link at the top, but it isn't clear what's being toggled. I've changed it to "Expand" and "Collapse" to make it clear that you are getting more and less information, respectively. Signed-off-by: Justin Waters <justin.waters@timesys.com>
2009-01-11ui-log: show name-decorations in log outputLars Hjemli1-0/+35
Commits are now decorated with a clickable 'label' for each ref pointing at it, similar to how gitweb and gitk displays commit decorations. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-06Merge branch 'full-log'Lars Hjemli1-7/+28
Conflicts: cgit.c cgit.h
2008-12-03ui-log: try to disambiguate ref namesLars Hjemli1-2/+15
The 'h' querystring parameter in cgit is normally used to specify a branch (i.e. a ref below refs/heads/), but if a repository contains a tag with the same name as a branch the output from ui-log would use the tag as start-revision. This patch tries to fix the issue by checking if the specified ref is valid as a branch name; if so, the full refname is used in the call to setup_revisions(). Noticed-by: Takamori Yamaguchi <akschar@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-11-30ui-log: use css to make full-log prettierLars Hjemli1-8/+6
Signed-off-by: Lars Hjemli <hjemli@gmail.com>