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>
Just like the config allows setting css URL path, add a config for
setting the js URL path
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Christian Hesse <mail@eworm.de>
Without changing the default behaviour of including
/cgit.css if nothing declared, allow the "css" config
to be given multiple times listing one or more
alternative URL paths to be included in the document
head area.
Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: Christian Hesse <mail@eworm.de>
Setting max-repo-count to "0" makes cgit loop forever generating page
links. Make this a special value to show all repositories.
Signed-off-by: Christian Hesse <mail@eworm.de>
Reading the README from repository used to be limited to default
branch or a branch given in configuration. Let's allow a branch
from query if not specified explicitly.
Signed-off-by: Christian Hesse <mail@eworm.de>
Update to git version v2.34.0, this requires changes for these
upstream commits:
* abf897bacd2d36b9dbd07c70b4a2f97a084704ee
string-list.[ch]: remove string_list_init() compatibility function
Signed-off-by: Christian Hesse <mail@eworm.de>
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>
Update to git version v2.25.0.
Upstream renamed 'init_display_notes()' to 'load_display_notes()' in
commit 1e6ed5441a61b5085978e0429691e2e2425f6846 ("notes: rename to
load_display_notes()").
Signed-off-by: Christian Hesse <mail@eworm.de>
Update to git version v2.22.0.
Upstream commit bce9db6d ("trace2: use system/global config for default
trace2 settings") caused a regression. We have to unset HOME and
XDG_CONFIG_HOME before early loading of config from trace2 code kicks in.
Signed-off-by: Christian Hesse <mail@eworm.de>
The blame operation can cause high cost in terms of CPU load for huge
repositories. Let's add a per repository override for enable-blame.
Signed-off-by: Christian Hesse <mail@eworm.de>
Even if we find snapshot-prefix in the repo configuration, we are not
writing it out into the rc- file, so setting the value does not have any
effect.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
The man page states these were deprecated for v1.0. We are past v1.1,
so remove the functionality.
Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
We had a static bit value in struct cgit_snapshot_format. We do not rely
on it and things can be calculated on the fly. So strip it.
Signed-off-by: Christian Hesse <mail@eworm.de>
Allow using a user-specified value for the prefix in snapshot files
instead of the repository basename. For example, files downloaded from
the linux-stable.git repository should be named linux-$VERSION and not
linux-stable-$VERSION, which can be achieved by setting:
repo.snapshot-prefix=linux
Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
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>
Implement a page which provides the blame view of a specified file.
This feature is controlled by a new config variable, "enable-blame",
which is disabled by default.
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
After the previous two patches, this can be classified as a tidy up
rather than a bug fix, but I think it makes sense to group all of the
tests together before setting up the environment for the command to
execute.
Signed-off-by: John Keeping <john@keeping.me.uk>
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...
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.
ctx.env.content_length is an unsigned int, coming from the
CONTENT_LENGTH environment variable, which is parsed by strtoul. The
HTTP/1.1 spec says that "any Content-Length greater than or equal to
zero is a valid value." By storing this into an int, we potentially
overflow it, resulting in the following bounding check failing, leading
to a buffer overflow.
Reported-by: Erik Cabetas <Erik@cabetas.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Everywhere else in this function we do not check whether the value is
null and parse_configfile() never passes a null value to this callback.
Coverity-id: 13846
Signed-off-by: John Keeping <john@keeping.me.uk>
These are more-or-less one-to-one translations but in the final hunk we
gain an HTTP error code where we used to send "200 OK", which is an
improvement.
Signed-off-by: John Keeping <john@keeping.me.uk>
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>
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>
If the global option enable-filter-overrides is set to 1 the repo-specific
options repo.hide and repo.ignore never got processed.
Signed-off-by: Daniel Reichelt <hacking@nachtgeist.net>
Reviewed-by: John Keeping <john@keeping.me.uk>
* 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>
These options can be used to hide a repository from the index or
completely ignore a repository, respectively. They are particularly
useful when used in combination with scan-path.
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
This will allow us to introduce a new "stat only" diff mode without
needing an explosion of mutually incompatible flags.
The old "ss" query parameter is still accepted in order to avoid
breaking saved links, but we no longer generate any URIs using it;
instead the new "dt" (diff type) parameter is used.
Signed-off-by: John Keeping <john@keeping.me.uk>
Specifying a nonexistent README file via the readme option is sometimes
useful, e.g. when using scan-path and setting a global default.
Currently, we check whether there is only one option in the readme
option and, if so, we choose that file without checking whether it
exists. As a consequence, all repositories are equipped with an about
link in the aforementioned scenario, even if there is no about file.
Remove the early check for the number of keys and always check whether
the file exists instead.
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
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.
This can be used to specify the TTL for snapshots. Snapshots are usually
static and do not ever change. On the other hand, tarball generation is
CPU intensive.
One use case of this setting (apart from increasing the lifetime of
snapshot cache slots) is caching of snapshots while disabling the cache
for static/dynamic HTML pages (by setting TTL to zero for everything
except for snapshot requests).
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>