Commit Graph

45 Commits

Author SHA1 Message Date
Christian Hesse
09d24d7cd0 git: update to v2.46.0
Update to git version v2.46.0, this requires changes for these
upstream commits:

* e7da9385708accf518a80a1e17969020fb361048
  global: introduce `USE_THE_REPOSITORY_VARIABLE` macro

* 9da95bda74cf10e1475384a71fd20914c3b99784
  hash: require hash algorithm in `oidread()` and `oidclr()`

* 30aaff437fddd889ba429b50b96ea4c151c502c5
  refs: pass repo when peeling objects

* c8f815c2083c4b340d4148a15d45c55f2fcc7d3f
  refs: remove functions without ref store

Signed-off-by: Christian Hesse <mail@eworm.de>
2024-08-02 18:22:56 +02:00
Christian Hesse
a6da40bf84 git: update to v2.41.0
Update to git version v2.41.0, with lots of changes...
This requires changes for these upstream commits:

* 60ff56f50372c1498718938ef504e744fe011ffb
  banned.h: mark `strtok()` and `strtok_r()` as banned

* 52acddf36c8cb3778ab2098a0d95cc2e375a4069
  string-list: multi-delimiter `string_list_split_in_place()`

* d850b7a545fcfbd97460a921c7f7c59d933eb0f7
  cocci: apply the "cache.h" part of "the_repository.pending"

* cb338c23d6d518947bf6f7240bf30e2ec232bd3b
  cocci: apply the "commit-reach.h" part of "the_repository.pending"

* ecb5091fd4301ac647db0bd2504112b38f7ee06d
  cocci: apply the "commit.h" part of "the_repository.pending"

* 085390328f5fe1dfba67039b1fd6cc51546a4e41
  cocci: apply the "diff.h" part of "the_repository.pending"

* bc726bd075929aab6b3e09d4dd5c2b0726fd5350
  cocci: apply the "object-store.h" part of "the_repository.pending"

* bab821646a74c446370fa8d01ca851f247df5033
  cocci: apply the "pretty.h" part of "the_repository.pending"

* afe27c889429438829bc8818ed17e4960bd3ef02
  cocci: apply the "packfile.h" part of "the_repository.pending"

* 12cb1c10a64170a5d600dd1c6c8abfeec105fb6b
  cocci: apply the "refs.h" part of "the_repository.pending"

* 035c7de9e9ea11d26df5f9e4bb117f91ed11a9fd
  cocci: apply the "revision.h" part of "the_repository.pending"

... and some more I missed to list 😜 - for example the move and cleanup
of headers and includes (see changes in `cgit.h`) comes to mind...

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-06-01 12:00:43 +02:00
Christian Hesse
5258c297ba git: update to v2.32.0
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>
2021-06-08 12:37:46 +02:00
Jason A. Donenfeld
6a8d6d4b50 global: use proper accessors for maybe_tree
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>
2020-03-13 17:48:34 -06:00
Christian Hesse
985fba80d0 git: update to v2.21.0
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>
2019-06-05 15:37:49 +02:00
Christian Hesse
2c9f56f3e1 git: update to v2.19.1
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-10-12 23:06:02 +02:00
Christian Hesse
255b78ff52 git: update to v2.18.0
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>
2018-06-27 18:13:03 +02:00
Jeff Smith
86a6d358f7 git: update to v2.14
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-10 15:58:24 +02:00
Christian Hesse
3d33b46df2 git: update to v2.13.4
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.
2017-08-10 15:15:54 +02:00
Christian Hesse
c330a2e5f8 ui-blog: fix oid handling
We have to use a pointer for walk_tree_ctx->matched_oid.

This fixes faulty commit 6e4b7b6776
(ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid').
2016-10-12 14:13:10 +02:00
Christian Hesse
6e4b7b6776 ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid'
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-10-04 09:47:18 +02:00
Jason A. Donenfeld
9ca2566972 ui-blob: set CSP just in case 2016-01-14 14:43:43 +01:00
Jason A. Donenfeld
92996ac2a6 ui-blob: always use generic mimetypes 2016-01-14 14:31:53 +01:00
Jason A. Donenfeld
1c581a0726 ui-blob: Do not accept mimetype from user 2016-01-14 14:31:13 +01:00
Christian Hesse
7320bfa893 ui-blob: fix resource leak: free before return
Coverity-id: 13944
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-10-10 21:39:25 +02:00
Christian Hesse
30802126d4 ui-blob: fix resource leak: free before return
Coverity-id: 13943
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-10-10 21:38:57 +02:00
John Keeping
509488d85c ui-blob: remove useless null check
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-10-09 10:54:38 +02:00
John Keeping
9a06211daa blob: use cgit_print_error_page() to add HTTP headers
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-08-14 15:46:51 +02:00
John Keeping
12d3d4c3ed Avoid signed bitfields
Bitfields are only defined for unsigned types.

Detected by sparse.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-03-09 17:38:46 +01:00
Christian Hesse
7358f63015 git: update for v2.3.0
* 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>
2015-02-08 18:11:09 +01:00
Christian Hesse
b431282c91 remove trailing whitespaces from source files 2014-04-17 12:55:09 +02:00
Lukas Fleischer
f60ffa143c Switch to exclusively using global ctx
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-17 00:44:54 +01:00
Lukas Fleischer
f7f26f8875 Update copyright information
* 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-08 15:10:49 +01:00
Jason A. Donenfeld
dcbc0438b2 readme: use string_list instead of space deliminations
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-26 16:30:03 +02:00
Jason A. Donenfeld
cd4c77d989 readme: Accept multiple candidates and test them.
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-05-25 20:33:28 +02:00
John Keeping
ed5bd30ebe Convert cgit_print_error to a variadic function
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-08 16:11:29 +02:00
John Keeping
8f20879431 Always #include corresponding .h in .c files
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-08 15:45:34 +02:00
John Keeping
1c32e008c8 ui-blob: don't segfault when no path is given
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-04-07 16:07:58 +02:00
Lukas Fleischer
41f9c4e2f6 ui-blob.c: Use a context structure in walk_tree()
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-04 09:12:54 -05:00
Jason A. Donenfeld
bdae1d8a8d White space around control verbs.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-03-04 09:12:54 -05:00
Lukas Fleischer
53bc747d31 Fix several whitespace errors
* 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-04 01:12:48 +01:00
John Keeping
c1633c6bef Update git to v1.7.6.5
struct pathspec is now used in more places.

Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-02 10:38:03 -05:00
Mark Lodato
d187b98557 prefer html_raw() to write()
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-09-04 14:30:10 -04:00
Jason A. Donenfeld
379e80e3a8 Support refspecs in about-filter.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2010-08-20 18:57:30 +02:00
Martins Polakovs
24538b0727 Fix segfault on ppc when browsing tree 2009-12-12 11:56:25 +01:00
Lars Hjemli
596eb8fcb0 ui-blob: return 'application/octet-stream' for binary blobs
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-07-25 11:51:19 +02:00
Lars Hjemli
566f92b276 Adjust to new calling convention for read_tree_recursive()
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-07-21 10:10:48 +02:00
Michael Krelin
42effc9390 allow specification of directly linked blobs mimetypes
Signed-off-by: Michael Krelin <hacker@klever.net>
2008-06-24 23:42:32 +02:00
Michael Krelin
01d2dce7e7 allow blob extract blobs by head/path combination
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-06-24 23:33:24 +02:00
Lars Hjemli
fa4dfee548 Don't specify mimetype in ui-blob.c
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-04-08 21:35:00 +02:00
Lars Hjemli
a4d1ca1dc6 Add ui-shared.h
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-24 16:50:57 +01:00
Lars Hjemli
b608e88adb Remove obsolete cacheitem parameter to ui-functions
This parameter hasn't been used for a very long time...

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24 01:01:28 +01:00
Lars Hjemli
f3c1a187fe Add struct cgit_page to cgit_context
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-24 00:51:19 +01:00
Lars Hjemli
b1f9b9c145 Introduce html.h
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>
2008-03-18 08:13:10 +01:00
Lars Hjemli
ca8eb8fc8f Add support for downloading single blobs
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2007-05-09 00:48:09 +02:00