aboutsummaryrefslogtreecommitdiffstats
path: root/ui-log.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: use release_commit_memory()John Keeping2022-12-191-4/+2
| | | | | | | | | | | | | | | Instead of calling two separate Git functions to free memory associated with a commit object, use Git's wrapper which does this. This also counts as a potential future bug fix since release_commit_memory() also resets the parsed state of the commit, meaning any attempt to use it in the future will correctly fill out the fields again. release_commit_memory() does not set parents to zero, so keep that for additional safety in case CGit checks this without calling parse_commit() again. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* git: update to v2.36.0Christian Hesse2022-04-181-1/+1
| | | | | | | | | | Update to git version v2.36.0, this requires changes for these upstream commits: * 95433eeed9eac439eb21eb30105354b15e71302e diff: add ability to insert additional headers for paths Signed-off-by: Christian Hesse <mail@eworm.de>
* git: update to v2.31.0Christian Hesse2021-03-161-3/+4
| | | | | | | | | | Update to git version v2.31.0, this requires changes for these upstream commits: * 36a317929b8f0c67d77d54235f2d20751c576cbb refs: switch peel_ref() to peel_iterated_oid() Signed-off-by: Christian Hesse <mail@eworm.de>
* global: replace references to 'sha1' with 'oid'Christian Hesse2020-10-201-3/+3
| | | | | | | | For some time now sha1 is considered broken and upstream is working to replace it with sha256. Replace all references to 'sha1' with 'oid', just as upstream does. Signed-off-by: Christian Hesse <mail@eworm.de>
* git: update to v2.29.0Christian Hesse2020-10-191-15/+15
| | | | | | | | | | | | | | | | | | | Update to git version v2.29.0, this requires changes for these upstream commits: * dbbcd44fb47347a3fdbee88ea21805b7f4ac0b98 strvec: rename files from argv-array to strvec * 873cd28a8b17ff21908c78c7929a7615f8c94992 argv-array: rename to strvec * d70a9eb611a9d242c1d26847d223b8677609305b strvec: rename struct fields * 6a67c759489e1025665adf78326e9e0d0981bab5 test-lib-functions: restrict test_must_fail usage Signed-off-by: Christian Hesse <mail@eworm.de>
* global: use proper accessors for maybe_treeJason A. Donenfeld2020-03-131-2/+2
| | | | | | | | | | | | | | A previous commit changed ->tree to ->maybe_tree throughout, which may have worked at the time, but wasn't safe, because maybe_tree is loaded lazily. This manifested itself in crashes when using the "follow" log feature. The proper fix is to use the correct contextual accessors everytime we want access to maybe_tree. Thankfully, the commit.cocci script takes care of creating mostly-correct patches that we could then fix up, resulting in this commit here. Fixes: 255b78f ("git: update to v2.18.0") Reviewed-by: Christian Hesse <mail@eworm.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* git: update to v2.21.0Christian Hesse2019-06-051-2/+2
| | | | | | | | | | | | | | Update to git version v2.21.0. Required changes follow upstream commits: * 6a7895fd8a3bd409f2b71ffc355d5142172cc2a0 (commit: prepare free_commit_buffer and release_commit_memory for any repo) * e092073d643b17c82d72cf692fbfaea9c9796f11 (tree.c: make read_tree*() take 'struct repository *') Signed-off-by: Christian Hesse <mail@eworm.de> Reviewed-by: John Keeping <john@keeping.me.uk>
* global: make 'char *path' const where possibleChristian Hesse2019-06-051-1/+1
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-log: ban strncpy()Christian Hesse2018-09-111-1/+1
| | | | | | | | | Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-log: ban strcpy()Christian Hesse2018-09-111-1/+1
| | | | | | | | | Git upstream bans strcpy() with commit: automatically ban strcpy() c8af66ab8ad7cd78557f0f9f5ef6a52fd46ee6dd Signed-off-by: Christian Hesse <mail@eworm.de>
* git: update to v2.18.0Christian Hesse2018-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update to git version v2.18.0. Required changes follow upstream commits: * Convert find_unique_abbrev* to struct object_id (aab9583f7b5ea5463eb3f653a0b4ecac7539dc94) * sha1_file: convert read_sha1_file to struct object_id (b4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8) * sha1_file: convert sha1_object_info* to object_id (abef9020e3df87c441c9a3a95f592fce5fa49bb9) * object-store: move packed_git and packed_git_mru to object store (a80d72db2a73174b3f22142eb2014b33696fd795) * treewide: rename tree to maybe_tree (891435d55da80ca3654b19834481205be6bdfe33) The changed data types required some of our own functions to be converted to struct object_id: ls_item print_dir print_dir_entry print_object single_tree_cb walk_tree write_tree_link And finally we use new upstream functions that were added for struct object_id: hashcpy -> oidcpy sha1_to_hex -> oid_to_hex Signed-off-by: Christian Hesse <mail@eworm.de> Reviewed-by: John Keeping <john@keeping.me.uk>
* ui-log: highlight annotated tags in different colorChristian Hesse2018-06-271-1/+5
| | | | | | | | | Annotated tags have some extra information... Descriptive text or signature. Highlighting annotated tags in a different color show what tag may be worth clicking for extra information. Signed-off-by: Christian Hesse <mail@eworm.de> Reviewed-by: John Keeping <john@keeping.me.uk>
* git: update to v2.16.0Christian Hesse2018-01-191-4/+3
| | | | | | | | | | | | | | | Update to git version v2.16.0: * refs: convert resolve_ref_unsafe to struct object_id (49e61479be913f67e66bb3fdf8de9475c41b58bd) * diff: remove DIFF_OPT_SET macro (23dcf77f48feb49c54bad09210f093a799816334) * log: add option to choose which refs to decorate (65516f586b69307f977cd67cc45513a296cabc25) * diff: convert flags to be stored in bitfields (02f2f56bc377c287c411947d0e1482aac888f8db) Signed-off-by: Christian Hesse <mail@eworm.de>
* git: update to v2.14Jeff Smith2017-08-101-5/+5
| | | | | | | | | | | | | | | | Numerous changes were made to git functions to use an object_id structure rather than sending sha1 hashes as raw unsigned character arrays. The functions that affect cgit are: parse_object, lookup_commit_reference, lookup_tag, lookup_tree, parse_tree_indirect, diff_root_tree_sha1, diff_tree_sha1, and format_display_notes. Commit b2141fc (config: don't include config.h by default) made it necessary to that config.h be explicitly included when needed. Commit 07a3d41 (grep: remove regflags from the public grep_opt API) removed one way of specifying the ignore-case grep option. Signed-off-by: Jeff Smith <whydoubt@gmail.com>
* css: highlight even table rows and skip empty rowsChristian Hesse2016-11-231-2/+3
| | | | | | This is stolen from kernel.org css [0]. [0] https://git.kernel.org/cgit-korg-0.10.1.css
* ui-log: replace get_sha1() with get_oid()Christian Hesse2016-10-041-1/+1
| | | | Data structures have been replaced already, so use correct function calls.
* git: update to v2.10.0Christian Hesse2016-09-041-1/+1
| | | | | | | | Upstream continues to replace unsigned char *sha1 with struct object_id old_oid. This makes the required changes. The git lib has its own main function now. Rename our main function to cmd_main, it is called from main then.
* ui-log: color line changesChristian Hesse2016-07-051-1/+2
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-log: Simplify decoration codeTim Nordell2016-05-121-24/+22
| | | | | | | | The decoration code inside of git returns the decoration type, so utilize this to create the decoration spans. Additionally, use prettify_refname(...) to get the shorter name for the ref. Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
* ui-log: Do not always emit decoration spanTim Nordell2016-05-121-0/+2
| | | | | | | | The decoration span does not need to be emited if there aren't any decorations to show. This modification saves slightly on bandwidth. Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
* ui: show ages in the originator's timezoneJohn Keeping2016-02-081-2/+2
| | | | | | | This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove "format" from cgit_print_age()John Keeping2016-02-081-2/+2
| | | | | | | We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-log: handle parse_commit() errorsJohn Keeping2016-01-171-1/+3
| | | | | | | | | | | | | If parse_commit() fails, none of the fields in the commit structure will have been populated so we will dereference NULL when accessing item->tree. There isn't much we can do about the error at this point, but if we return true then we'll try parsing the commit again from print_commit() and we can report an error to the user at that point. Coverity-id: 13801 Signed-off-by: John Keeping <john@keeping.me.uk>
* git: update to v2.7.0Christian Hesse2016-01-131-6/+6
| | | | | | | | | | | | | | Update to git version v2.7.0. * Upstream commit ed1c9977cb1b63e4270ad8bdf967a2d02580aa08 (Remove get_object_hash.) changed API: Convert all instances of get_object_hash to use an appropriate reference to the hash member of the oid member of struct object. This provides no functional change, as it is essentially a macro substitution. Signed-off-by: Christian Hesse <mail@eworm.de>
* log: move layout into page functionJohn Keeping2015-08-141-1/+4
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-log: fix double countingJohn Keeping2015-08-121-2/+2
| | | | | | | This crept in while rebasing the previous commit onto an updated upstream. Signed-off-by: John Keeping <john@keeping.me.uk>
* log: allow users to follow a fileJohn Keeping2015-08-121-11/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach the "log" UI to behave in the same way as "git log --follow", when given a suitable instruction by the user. The default behaviour remains to show the log without following renames, but the follow behaviour can be activated by following a link in the page header. Follow is not the default because outputting merges in follow mode is tricky ("git log --follow" will not show merges). We also disable the graph in follow mode because the commit graph is not simplified so we end up with frequent gaps in the graph and many lines that do not connect with any commits we're actually showing. We also teach the "diff" and "commit" UIs to respect the follow flag on URLs, causing the single-file version of these UIs to detect renames. This feature is needed only for commits that rename the path we're interested in. For commits before the file has been renamed (i.e. that appear later in the log list) we change the file path in the links from the log to point to the old name; this means that links to commits always limit by the path known to that commit. If we didn't do this we would need to walk down the log diff'ing every commit whenever we want to show a commit. The drawback is that the "Log" link in the top bar of such a page links to the log limited by the old name, so it will only show pre-rename commits. I consider this a reasonable trade-off since the "Back" button still works and the log matches the path displayed in the top bar. Since following renames requires running diff on every commit we consider, I've added a knob to the configuration file to globally enable/disable this feature. Note that we may consider a large number of commits the revision walking machinery no longer performs any path limitation so we have to examine every commit until we find a page full of commits that affect the target path or something related to it. Suggested-by: René Neumann <necoro@necoro.eu> Signed-off-by: John Keeping <john@keeping.me.uk>
* git: update to v2.5.0Christian Hesse2015-08-121-2/+2
| | | | | | | | | | | | | | | Update to git version v2.5.0. * Upstream commit 5455ee0573a22bb793a7083d593ae1ace909cd4c (Merge branch 'bc/object-id') changed API: for_each_ref() callback functions were taught to name the objects not with "unsigned char sha1[20]" but with "struct object_id". * Upstream commit dcf692625ac569fefbe52269061230f4fde10e47 (path.c: make get_pathname() call sites return const char *) Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-log: make some variables 'static'John Keeping2015-03-091-1/+1
| | | | | | These are not used outside this file and are not declared. Signed-off-by: John Keeping <john@keeping.me.uk>
* tag: reference with "h" instead of "id"John Keeping2015-01-191-2/+2
| | | | | | | | | | | | | | | When clicking on "log" from a tag we end up showing the log of whatever branch we used to reach the tag. If the tag doesn't point onto a branch then the tagged commit won't appear in this output. By linking to tags with the head parameter instead of the "id" parameter the log link will show the log of the tag. This is clearly desirable when the tag has been reached from the refs UI and changing the behaviour for tag decorations makes them match branch decorations where log -> decoration -> log shows the log of the decoration. Reported-by: Ferry Huberts <mailings@hupie.com> Signed-off-by: John Keeping <john@keeping.me.uk>
* git: update to v2.2.1Christian Hesse2014-12-231-2/+2
| | | | | | Update to git version v2.2.1, including API changes. Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-shared: remove toggle_ssdiff arg to cgit_commit_link()John Keeping2014-12-131-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>
* git: update to v2.0.3John Keeping2014-07-281-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>
* ui-log: ignore unhandled argumentsJohn Keeping2014-06-281-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>
* git: update for git 2.0Christian Hesse2014-06-281-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.
* filter: add page source to email filterJason A. Donenfeld2014-01-141-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>
* filter: add support for email filterJason A. Donenfeld2014-01-141-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Update copyright informationLukas Fleischer2014-01-081-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>
* ui-log.c: Several simplificationsLukas Fleischer2014-01-081-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>
* Use argv_array in place of vectorLukas Fleischer2014-01-081-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>
* ui-log: add <span/> around commit decorationsJohn Keeping2013-05-221-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>
* Do not load user or system gitconfig and gitattributesJason A. Donenfeld2013-04-081-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>
* use struct strbuf instead of static buffersJohn Keeping2013-04-081-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>
* Always #include corresponding .h in .c filesJohn Keeping2013-04-081-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>
* Update git to v1.8.2.1John Keeping2013-04-081-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>
* Convert pager navigation into a unordered listLukas Fleischer2013-03-201-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>
* Fix colspan valuesLukas Fleischer2013-03-201-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>
* Mark several functions/variables staticLukas Fleischer2013-03-041-3/+3
| | | | | | Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-log: Add "commit-sort" option for controlling commit orderingTobias Bieniek2012-10-171-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>
* Merge branch 'stable'Lars Hjemli2012-01-031-0/+3
|\