|
f2400a9c
|
2020-07-13T20:56:08
|
|
config_entries: Avoid excessive map operations
When appending config entries, we currently always first get the
currently existing map entry and then afterwards update the map to
contain the current config value. In the common scenario where keys
aren't being overridden, this is the best we can do. But in case a key
gets set multiple times, then we'll also perform these two map
operations. In extreme cases, hashing the map keys will thus start to
dominate performance.
Let's optimize the pattern by using a separately allocated map entry.
Currently, we always put the current list entry into the map and update
it to get any overridden multivar. As these list entries are also used
to iterate config entries, we cannot update them in-place in the map and
are thus forced to always set the map to contain the new entry. But with
a separately allocated map entry, we can now create one once per config
key and insert it into the map. Whenever appending a new config value
with the same key, we can now just update the map entry in-place instead
of having to replace the map entry completely.
This reduces calls to the hashing function by half and trades the
improved runtime for one more allocation per unique config key. Given
that the refactoring arguably improves code readability by splitting
concerns of the `config_entry_list` type and not having to track it in
two different structures, this alone would already be reason enough to
take the trade.
Given a pathological case of a gitconfig with 100.000 repeated keys and
a section of length 10.000 characters, this reduces runtime by half from
approximately 14 seconds to 7 seconds as expected.
|
|
ae30009e
|
2020-07-12T16:01:15
|
|
Merge pull request #5547 from pks-t/pks/cmake-modernization-pt2
CMake modernization pt2
|
|
4218403e
|
2020-06-05T10:49:09
|
|
cmake: use target-specific compile definitions
We set up some compile definitions as part of our src/CMakeLists.txt.
While the definitions are global, we really only need them as part of
the git2internal target which compiles all the objects. Let's thus use
`target_compile_definitions` instead of `add_definitions`.
|
|
53911edd
|
2020-06-05T10:24:30
|
|
cmake: use git2internal target to populate sources
Modern CMake is usually target-driven in that a target is first defined
and then the likes of `target_sources`, `target_include_directories`
etc. are used to further populate the target. We still use old-style
CMake, where we first set up a set of variables and then populate the
target in a single call.
Let's migrate to modern CMake usage by starting to populate the sources
of our git2internal target piece-by-piece. While this is a small step,
it allows us to convert to target-based build instructions
piece-by-piece.
|
|
9bc6e655
|
2020-06-05T11:37:30
|
|
cmake: remove CheckPrototypeDefinition module
In the past, we've imported the CheckPrototypeDefinition into our own
module directory as it wasn't yet available in all supported CMake
versions. Now that we require at least CMake v3.5, we don't need to
bundle it anymore as it's included with the distribution already.
Let's drop the included modules and always use upstream's version.
|
|
19eb1e4b
|
2020-06-05T10:07:33
|
|
cmake: specify project version
We currently do not set up a project version within CMake, meaning that
it can't be use by other projects including libgit2 as a sub-project and
also not by other tools like IDEs.
This commit changes this to always set up a project version, but instead
of extracting it from the "version.h" header we now set it up directly.
This is mostly to avoid mis-use of the previous `LIBGIT2_VERSION`
variables, as we should now always use the `libgit2_VERSION` ones that
are set up by CMake if one provides the "VERSION" keyword to the
`project()` call. While this is one more moving target we need to adjust
on releases, this commit also adjusts our release script to verify that
the project version was incremented as expected.
|
|
325375e3
|
2020-07-09T23:12:58
|
|
Merge pull request #5568 from lhchavez/ubsan
Make the tests run cleanly under UndefinedBehaviorSanitizer
|
|
2ffa426e
|
2020-07-09T23:02:05
|
|
Merge pull request #5567 from lhchavez/msan
Make the tests pass cleanly with MemorySanitizer
|
|
60536163
|
2020-07-09T22:56:44
|
|
Merge pull request #5561 from A-Ovchinnikov-mx/a-ovchin/windres-rc
Enable building git2.rc resource script with GCC
|
|
8720ae8a
|
2020-07-02T11:45:16
|
|
Merge pull request #5571 from lhchavez/ntlmclient-sanitizers
Make NTLMClient Memory and UndefinedBehavior Sanitizer-clean
|
|
dc1deb3b
|
2020-07-01T15:41:38
|
|
Use __GNUC__ macro in the resource script
Fix the default LIBGIT2_FILENAME for GNU windres
|
|
71000441
|
2020-06-16T18:58:07
|
|
Review: Rename the stringize macro
|
|
5c40456b
|
2020-06-16T13:19:02
|
|
Enable building git2.rc resource script with GCC
|
|
7c964416
|
2020-06-30T05:46:47
|
|
Make NTLMClient Memory and UndefinedBehavior Sanitizer-clean
This change makes the code pass the libgit2 tests cleanly when
MSan/UBSan are enabled. Notably:
* Changes malloc/memset combos into calloc for easier auditing.
* Makes `write_buf` return early if the buffer length is empty to avoid
arithmetic with NULL pointers (which UBSan does not like).
* Initializes a few arrays that were sometimes being read before being
written to.
|
|
3a197ea7
|
2020-06-27T12:33:32
|
|
Make the tests pass cleanly with MemorySanitizer
This change:
* Initializes a few variables that were being read before being
initialized.
* Includes https://github.com/madler/zlib/pull/393. As such,
it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
|
|
d0656ac8
|
2020-06-27T12:15:26
|
|
Make the tests run cleanly under UndefinedBehaviorSanitizer
This change makes the tests run cleanly under
`-fsanitize=undefined,nullability` and comprises of:
* Avoids some arithmetic with NULL pointers (which UBSan does not like).
* Avoids an overflow in a shift, due to an uint8_t being implicitly
converted to a signed 32-bit signed integer after being shifted by a
32-bit signed integer.
* Avoids a unaligned read in libgit2.
* Ignores unaligned reads in the SHA1 library, since it only happens on
Intel processors, where it is _still_ undefined behavior, but the
semantics are moderately well-understood.
Of notable omission is `-fsanitize=integer`, since there are lots of
warnings in zlib and the SHA1 library which probably don't make sense to
fix and I could not figure out how to silence easily. libgit2 itself
also has ~100s of warnings which are mostly innocuous (e.g. use of enum
constants that only fit on an `uint32_t`, but there is no way to do that
in a simple fashion because the data type chosen for enumerated types is
implementation-defined), and investigating whether there are worrying
warnings would need reducing the noise significantly.
|
|
d6c62852
|
2020-06-23T09:16:05
|
|
Merge pull request #5559 from pks-t/pks/diff-print-fixups
Random fixes for diff-printing
|
|
d43d490c
|
2020-06-17T17:51:19
|
|
Merge pull request #5419 from lhchavez/fix-git_index_add_from_buffer-docs
index: Update the documentation for git_index_add_from_buffer()
|
|
6256d023
|
2020-06-15T14:34:29
|
|
diff_print: adjust code to match current coding style
|
|
490d0c9c
|
2020-06-15T14:26:13
|
|
diff_print: return out-of-memory situation when printing binary
We currently don't check for out-of-memory situations on exiting
`format_binary` and, as a result, may return a partially filled buffer.
Fix this by checking the buffer via `git_buf_oom`.
|
|
bea5fd9f
|
2020-06-15T13:26:18
|
|
diff_print: do not call abort(3P)
Calling abort(3P) in a library is rather rude and shouldn't happen, as
we effectively prohibit any corrective actions made by the application
linking to it. We thus shouldn't call it at all, but instead use our new
`GIT_ASSERT` macros.
Remove the call to abort(3P) in case a diff delta has an unexpected type
to fix this.
|
|
0cf1f444
|
2020-06-15T13:19:44
|
|
diff_print: handle errors when printing to file
When printing the diff to a `FILE *` handle, we neither check the return
value of fputc(3P) nor the one of fwrite(3P). As a result, we'll
silently return successful even if we didn't print anything at all.
Futhermore, the arguments to fwrite(3P) are reversed: we have one item
of length `content_len`, and not `content_len` items of one byte.
Fix both issues by checking return values as well as reversing the
arguments to fwrite(3P).
|
|
d60bf002
|
2020-06-16T17:02:40
|
|
Merge pull request #5550 from libgit2/ethomson/github_actions
Introduce CI with GitHub Actions
|
|
47fb33ba
|
2020-06-07T00:39:27
|
|
Introduce CI with GitHub Actions
Add CI using GitHub Actions and GitHub Packages:
* This moves our Linux build containers into GitHub Packages; we will
identify the most recent commit that updated the docker descriptions,
and then look for a docker image in libgit2's GitHub Packages registry
for a container with the tag corresponding to that description. If
there is not one, we will build the container and then push it to
GitHub Packages.
* We no longer need to manage authentication with our own credentials or
PAT tokens. GitHub Actions provides a GITHUB_TOKEN that can publish
artifacts, packages and commits to our repository within a workflow
run.
* We will use a matrix to build our various CI steps. This allows us
to keep configuration in a single place without multiple YAML files.
|
|
74520b91
|
2020-06-13T19:38:11
|
|
Merge pull request #5552 from libgit2/pks/small-fixes
Random code cleanups and fixes
|
|
79d0e0c1
|
2020-06-12T18:21:46
|
|
Merge pull request #5553 from pks-t/pks/example-log-docfix
examples: log: fix documentation generation
|
|
4852d8da
|
2020-06-10T22:18:13
|
|
docker: don't take BASE as an argument
The xenial image depends on ubuntu:xenial; the bionic one on
ubuntu:bionic. No need for this to be a variable, that's just
additional (unnecessary) state to manage in the CI setup(s).
|
|
8b8b69a7
|
2020-06-10T22:13:25
|
|
azure pipelines: use bundled zlib
Azure Pipelines has a version of zlib hanging out on the filesystem;
avoid trying to use it as it's either 64 _or_ 32 bit, so exactly one of
our builds will fail.
|
|
96a5f38f
|
2020-06-10T07:42:52
|
|
Merge pull request #5551 from pks-t/pks/missing-declarations
Missing declarations
|
|
c6184f0c
|
2020-06-08T21:07:36
|
|
tree-wide: do not compile deprecated functions with hard deprecation
When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor
definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h"
header to be empty. As a result, no function declarations are made
available to callers, but the implementations are still available to
link against. This has the problem that function declarations also
aren't visible to the implementations, meaning that the symbol's
visibility will not be set up correctly. As a result, the resulting
library may not expose those deprecated symbols at all on some platforms
and thus cause linking errors.
Fix the issue by conditionally compiling deprecated functions, only.
While it becomes impossible to link against such a library in case one
uses deprecated functions, distributors of libgit2 aren't expected to
pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually
define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real"
hard deprecation still makes sense in the context of CI to test we don't
use deprecated symbols ourselves and in case a dependant uses libgit2 in
a vendored way and knows it won't ever use any of the deprecated symbols
anyway.
|
|
6e1efcd6
|
2020-06-08T12:46:04
|
|
tree-wide: add missing header includes
We're missing some header includes leading to missing function
prototypes. While we currently don't warn about these, we should have
their respective headers included in order to detect the case where a
function signature change results in an incompatibility.
|
|
a6c9e0b3
|
2020-06-08T12:40:47
|
|
tree-wide: mark local functions as static
We've accumulated quite some functions which are never used outside of
their respective code unit, but which are lacking the `static` keyword.
Add it to reduce their linkage scope and allow the compiler to optimize
better.
|
|
03c4f86c
|
2020-06-08T12:42:59
|
|
cmake: enable warnings for missing function declarations
Over time, we have accumulated quite a lot of functions with missing
prototypes, missing `static` keywords or which were completely unused.
It's easy to miss these mistakes, but luckily GCC and Clang both have
the `-Wmissing-declarations` warning. Enabling this will cause them to
emit warnings for every not-static function that doesn't have a previous
declaration. This is a very sane thing to enable, and with the preceding
commits all these new warnings have been fixed.
So let's always enable this warning so we won't introduce new instances
of them.
|
|
fd1f0940
|
2020-06-08T12:42:26
|
|
refs: add missing function declaration
The function `git_reference__is_note` is not declared anywhere. Let's
add the declaration to avoid having non-static functions without
declaration.
|
|
7c499b54
|
2020-06-08T12:39:09
|
|
tree-wide: remove unused functions
We have some functions which aren't used anywhere. Let's remove them to
get rid of unneeded baggage.
|
|
939cb73f
|
2020-06-08T15:28:20
|
|
examples: log: fix documentation generation
Docurium seems to be confused by our use of `/** comment */;` use in the
log example. Let's just switch it around to help Docurium get this
right.
|
|
46637b5e
|
2020-06-08T14:47:01
|
|
checkout: remove unused code for deferred removals
With commit 05f690122 (checkout: remove blocking dir when FORCEd,
2015-03-31), the last case was removde that actually queued a deferred
removal. This is now more than five years in the past and nobody
complained, so we can rest quite assured that the deferred removal is
not really needed at all.
Let's remove all related code to simplify the already complicated
checkout logic.
|
|
9e4e25b1
|
2020-06-08T12:57:48
|
|
tests: refs: modernize coding style of testcase
The coding style of the testcase refs::create::propagate_eexists is not
really up-to-date. Convert it to use a more modern coding style.
|
|
45901d3e
|
2020-06-08T12:57:16
|
|
revparse: remove superfluous tab character
|
|
c146374c
|
2020-06-08T12:54:26
|
|
revparse: detect out-of-memory cases when parsing curly brace contents
When extracting curly braces (e.g. the "upstream" part in
"HEAD@{upstream}"), we put the curly braces' contents into a `git_buf`
structure, but don't check the return value of `git_buf_putc`. So when
we run out-of-memory, we'll use a partially filled buffer without
noticing.
Let's fix this issue by checking `git_buf_putc`'s return value.
|
|
b2217552
|
2020-06-07T01:02:38
|
|
Revert .github/workflows/main.yml
|
|
c16ba496
|
2020-06-07T00:37:55
|
|
yo
|
|
d1f3933e
|
2020-06-07T00:35:19
|
|
Update main.yml
|
|
e51002ab
|
2020-06-07T00:33:18
|
|
Update main.yml
|
|
8f48cbf7
|
2020-06-07T00:30:39
|
|
Update main.yml
|
|
6bf744dc
|
2020-06-07T00:28:47
|
|
Update main.yml
|
|
ad1c8e92
|
2020-06-07T00:26:53
|
|
Update main.yml
|
|
9f6e21a0
|
2020-06-07T00:24:45
|
|
Update main.yml
|
|
80c6b0a2
|
2020-06-07T00:16:57
|
|
Update bionic
|
|
4a95ee8d
|
2020-06-07T00:16:39
|
|
Update xenial
|
|
c2ac139c
|
2020-06-07T00:12:47
|
|
Update xenial
|
|
0d82e49f
|
2020-06-07T00:12:17
|
|
Update bionic
|
|
308fc153
|
2020-06-06T23:59:28
|
|
Update main.yml
|
|
074c7753
|
2020-06-06T23:49:42
|
|
Update main.yml
|
|
5f4b3017
|
2020-06-06T23:44:51
|
|
Update main.yml
|
|
78ed45d5
|
2020-06-06T23:25:25
|
|
Update main.yml
|
|
09d00c3e
|
2020-06-06T23:21:35
|
|
Update main.yml
|
|
92ab4213
|
2020-06-06T23:16:52
|
|
Update main.yml
|
|
2e8cc08e
|
2020-06-06T23:15:08
|
|
Update main.yml
|
|
7ebb420a
|
2020-06-06T23:06:11
|
|
Update main.yml
|
|
42c5d7c2
|
2020-06-06T23:02:10
|
|
Update main.yml
|
|
045429f5
|
2020-06-06T22:44:20
|
|
Update main.yml
|
|
e3683c72
|
2020-06-06T22:41:02
|
|
Update main.yml
|
|
fbb71d0c
|
2020-06-06T22:32:33
|
|
Update main.yml
|
|
982a1def
|
2020-06-06T22:30:16
|
|
Update main.yml
|
|
7e5a1ce3
|
2020-06-06T22:27:37
|
|
Update main.yml
|
|
a9e252d4
|
2020-06-06T22:23:19
|
|
Update main.yml
|
|
c199d5e8
|
2020-06-06T22:21:53
|
|
Update main.yml
|
|
aaf96aff
|
2020-06-06T22:00:36
|
|
Update main.yml
|
|
d7b0e918
|
2020-06-06T21:58:02
|
|
Update main.yml
|
|
37af2a0d
|
2020-06-06T21:55:27
|
|
Update main.yml
|
|
7c518a59
|
2020-06-06T21:22:44
|
|
Update main.yml
|
|
e310a0cb
|
2020-06-06T21:21:33
|
|
Update main.yml
|
|
7f6f2790
|
2020-06-06T21:20:51
|
|
Update main.yml
|
|
f5510222
|
2020-06-06T21:18:42
|
|
Update main.yml
|
|
070633db
|
2020-06-06T21:17:54
|
|
Update main.yml
|
|
f356952b
|
2020-06-06T21:01:51
|
|
Update main.yml
|
|
c31c10cc
|
2020-06-06T21:00:15
|
|
Update main.yml
|
|
a2c42999
|
2020-06-06T20:58:19
|
|
Update main.yml
|
|
4eb9c0a5
|
2020-06-06T20:57:51
|
|
Update main.yml
|
|
7861a86b
|
2020-06-06T20:56:01
|
|
Update main.yml
|
|
09439368
|
2020-06-06T20:53:23
|
|
Update main.yml
|
|
ddfeb4aa
|
2020-06-06T20:52:54
|
|
Update main.yml
|
|
2540fd08
|
2020-06-06T20:52:15
|
|
Update main.yml
|
|
6ad47348
|
2020-06-06T20:50:45
|
|
Update main.yml
|
|
8e794b0e
|
2020-06-06T20:49:30
|
|
Update main.yml
|
|
1849f89a
|
2020-06-06T20:42:15
|
|
Update main.yml
|
|
3454dd64
|
2020-06-06T20:38:56
|
|
Update main.yml
|
|
43667e57
|
2020-06-06T17:39:58
|
|
Update main.yml
|
|
560ca69a
|
2020-06-06T17:30:48
|
|
Update main.yml
|
|
41e18bd4
|
2020-06-06T17:28:06
|
|
Update main.yml
|
|
69b6027c
|
2020-06-06T17:26:58
|
|
Update main.yml
|
|
5a5335f4
|
2020-06-06T17:25:52
|
|
Update main.yml
|
|
a1b454e0
|
2020-06-06T17:24:32
|
|
Update main.yml
|
|
4a8f9f77
|
2020-06-06T17:22:57
|
|
Update main.yml
|
|
94017145
|
2020-06-06T17:20:23
|
|
Update main.yml
|
|
6c8ad0f8
|
2020-06-06T17:16:10
|
|
Update main.yml
|
|
6527b35e
|
2020-06-06T16:38:55
|
|
Update main.yml
|
|
309b6148
|
2020-06-06T16:38:01
|
|
Update main.yml
|
|
0a8fa2a5
|
2020-06-06T16:34:08
|
|
Update main.yml
|