aboutsummaryrefslogtreecommitdiffstats
path: root/ui-blob.c
AgeCommit message (Collapse)AuthorFilesLines
2021-06-08git: update to v2.32.0Christian Hesse1-12/+8
Update to git version v2.32.0, this requires changes for these upstream commits: * 47957485b3b731a7860e0554d2bd12c0dce1c75a tree.h API: simplify read_tree_recursive() signature Signed-off-by: Christian Hesse <mail@eworm.de>
2020-03-14global: use proper accessors for maybe_treeJason A. Donenfeld1-6/+11
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>
2019-06-05git: update to v2.21.0Christian Hesse1-3/+6
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>
2018-10-12git: update to v2.19.1Christian Hesse1-3/+3
Update to git version v2.19.1. Required changes follow upstream commits: * commit: add repository argument to get_cached_commit_buffer (3ce85f7e5a41116145179f0fae2ce6d86558d099) * commit: add repository argument to lookup_commit_reference (2122f6754c93be8f02bfb5704ed96c88fc9837a8) * object: add repository argument to parse_object (109cd76dd3467bd05f8d2145b857006649741d5c) * tag: add repository argument to deref_tag (a74093da5ed601a09fa158e5ba6f6f14c1142a3e) * tag: add repository argument to lookup_tag (ce71efb713f97f476a2d2ab541a0c73f684a5db3) * tree: add repository argument to lookup_tree (f86bcc7b2ce6cad68ba1a48a528e380c6126705e) * archive.c: avoid access to the_index (b612ee202a48f129f81f8f6a5af6cf71d1a9caef) * for_each_*_object: move declarations to object-store.h (0889aae1cd18c1804ba01c1a4229e516dfb9fe9b) Signed-off-by: Christian Hesse <mail@eworm.de>
2018-06-27git: update to v2.18.0Christian Hesse1-12/+12
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>
2017-08-10git: update to v2.14Jeff Smith1-3/+3
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>
2017-08-10git: update to v2.13.4Christian Hesse1-3/+6
Update to git version v2.13.4: With commit 8aee769f (pathspec: copy and free owned memory) the definition of struct pathspec_item has changed with the expectation that pathspecs will be managed dynamically. We work around this a bit by setting up a static structure, but let's allocate the match string to avoid needing to cast away const. Updated a patch from John Keeping <john@keeping.me.uk> for git v2.12.1.
2016-10-12ui-blog: fix oid handlingChristian Hesse1-5/+5
We have to use a pointer for walk_tree_ctx->matched_oid. This fixes faulty commit 6e4b7b6776eb994e795fa38b2619db6c55e10ecc (ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid').
2016-10-04ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid'Christian Hesse1-22/+22
Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id oid'. We have some code that can be changed independent from upstream. So here we go... In addition replace memmove() with hashcpy().
2016-01-14ui-blob: set CSP just in caseJason A. Donenfeld1-0/+3
2016-01-14ui-blob: always use generic mimetypesJason A. Donenfeld1-6/+4
2016-01-14ui-blob: Do not accept mimetype from userJason A. Donenfeld1-1/+0
2015-10-10ui-blob: fix resource leak: free before returnChristian Hesse1-0/+1
Coverity-id: 13944 Signed-off-by: Christian Hesse <mail@eworm.de>
2015-10-10ui-blob: fix resource leak: free before returnChristian Hesse1-0/+1
Coverity-id: 13943 Signed-off-by: Christian Hesse <mail@eworm.de>
2015-10-09ui-blob: remove useless null checkJohn Keeping1-1/+1
We have already called strlen() on "path" by the time we get here, so we know it can't be null. Coverity-id: 13954 Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-14blob: use cgit_print_error_page() to add HTTP headersJohn Keeping1-4/+8
This is a bugfix as well as an improvement to the HTTP status code handling since previously we would not print HTTP headers on any of these code paths. Signed-off-by: John Keeping <john@keeping.me.uk>
2015-03-09Avoid signed bitfieldsJohn Keeping1-2/+2
Bitfields are only defined for unsigned types. Detected by sparse. Signed-off-by: John Keeping <john@keeping.me.uk>
2015-02-08git: update for v2.3.0Christian Hesse1-4/+4
* sort_string_list(): rename to string_list_sort() (upstream commit 3383e199) * update read_tree_recursive callback to pass strbuf as base (upstream commit 6a0b0b6d) Signed-off-by: Christian Hesse <mail@eworm.de>
2014-04-17remove trailing whitespaces from source filesChristian Hesse1-1/+1
2014-01-17Switch to exclusively using global ctxLukas Fleischer1-1/+1
Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_print_http_headers() * cgit_print_docstart() * cgit_print_pageheader() Remove context parameter from all commands Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_get_cmd() * All cgit command functions. * cgit_clone_info() * cgit_clone_objects() * cgit_clone_head() * cgit_print_plain() * cgit_show_stats() In initialization routines, use the global context variable instead of passing a pointer around locally. Remove callback data parameter for cache slots This is no longer needed since the context is always read from the global context variable. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2014-01-08Update copyright informationLukas Fleischer1-2/+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>
2013-05-26readme: use string_list instead of space deliminationsJason A. Donenfeld1-27/+34
Now this is possible in cgitrc - readme=:README.md readme=:readme.md readme=:README.mkd readme=:readme.mkd readme=:README.rst readme=:readme.rst readme=:README.html readme=:readme.html readme=:README.htm readme=:readme.htm readme=:README.txt readme=:readme.txt readme=:README readme=:readme readme=:INSTALL.txt readme=:install.txt readme=:INSTALL readme=:install Suggested-by: John Keeping <john@keeping.me.uk> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-05-25readme: Accept multiple candidates and test them.Jason A. Donenfeld1-1/+27
The readme variable may now contain multiple space deliminated entries, which per usual are either a filepath or a git ref filepath. If multiple are specified, cgit will now select the first one in the list that exists. This is to make it easier to specify multiple default readme types in the main cgitrc file and have them automatically get applied to each repo based on what exists. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-04-08Convert cgit_print_error to a variadic functionJohn Keeping1-4/+4
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>
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-07ui-blob: don't segfault when no path is givenJohn Keeping1-1/+1
It it possible to inspect blobs by specifying only the SHA-1, and CGit provides links to do so, for example if a tag points directly at a blob. In this case the path_items structure is never used, but creating it still causes strlen to be run on a null pointer. Fix this. This error was introduced by commit c1633c6 (Update git to v1.7.6.5 - 2013-03-02). Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-04ui-blob.c: Use a context structure in walk_tree()Lukas Fleischer1-16/+26
Do not misuse global variables to save the context. Instead, use the context pointer which was designed to share information between a read_tree_fn and the caller. This also prevents from potential misuse of the global pointers match_path and matched_sha1 after the referenced values have been overwritten on the stack. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-04White space around control verbs.Jason A. Donenfeld1-4/+4
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-03-04Fix several whitespace errorsLukas Fleischer1-5/+5
* Remove whitespace at the end of lines. * Replace space indentation by tabs. * Add whitespace before/after several operators ("+", "-", "*", ...) * Add whitespace to assignments ("foo = bar;"). * Fix whitespace in parameter lists ("foobar(foo, bar, 42)"). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-02Update git to v1.7.6.5John Keeping1-4/+18
struct pathspec is now used in more places. Signed-off-by: John Keeping <john@keeping.me.uk>
2010-09-04prefer html_raw() to write()Mark Lodato1-2/+2
To make the code more consistent, and to not rely on the implementation of html(), always use html_raw(...) instead of write(htmlfd, ...). Signed-off-by: Mark Lodato <lodatom@gmail.com>
2010-08-20Support refspecs in about-filter.Jason A. Donenfeld1-1/+34
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-12-12Fix segfault on ppc when browsing treeMartins Polakovs1-1/+1
2009-07-25ui-blob: return 'application/octet-stream' for binary blobsLars Hjemli1-1/+7
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-07-21Adjust to new calling convention for read_tree_recursive()Lars Hjemli1-2/+3
In GIT-1.6.0, read_tree_recursive takes an extra void pointer for callback data. We might want to use this to avoid some global variables, but for now lets just make sure that we can still compile. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-06-24allow specification of directly linked blobs mimetypesMichael Krelin1-1/+1
Signed-off-by: Michael Krelin <hacker@klever.net>
2008-06-24allow blob extract blobs by head/path combinationMichael Krelin1-4/+33
If blob is invoked with no id=, it tries to look up h= and search for path= in there. Once found, proceed as normal, otherwise, fail as normal. Signed-off-by: Michael Krelin <hacker@klever.net>
2008-04-08Don't specify mimetype in ui-blob.cLars Hjemli1-1/+1
But be sure to specify correct filename. This way, the client can hopefully guess a sensible mimetype based on the filename suffix, and cgit can ignore the issue altogether. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24Add ui-shared.hLars Hjemli1-0/+1
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>
2008-03-24Remove obsolete cacheitem parameter to ui-functionsLars Hjemli1-1/+1
This parameter hasn't been used for a very long time... Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24Add struct cgit_page to cgit_contextLars Hjemli1-1/+3
This struct is used when generating http headers, and as such is another small step towards the goal of the whole cleanup series; to invoke each page/view function with a function pointer. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-18Introduce html.hLars Hjemli1-0/+9
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>
2007-05-09Add support for downloading single blobsLars Hjemli1-0/+31
Signed-off-by: Lars Hjemli <hjemli@gmail.com>