Commit Graph

9901 Commits

Author SHA1 Message Date
Patrick Steinhardt
59c6c2860a global: synchronize initialization and shutdown with pthreads
When trying to initialize and tear down global data structures
from different threads at once with `git_libgit2_init` and
`git_libgit2_shutdown`, we race around initializing data. While
we use `pthread_once` to assert that we only initilize data a
single time, we actually reset the `pthread_once_t` on the last
call to `git_libgit2_shutdown`. As resetting this variable is not
synchronized with other threads trying to access it, this is
actually racy when one thread tries to do a complete shutdown of
libgit2 while another thread tries to initialize it.

Fix the issue by creating a mutex which synchronizes `init_once`
and the library shutdown.
2016-11-01 14:30:47 +01:00
Carlos Martín Nieto
41ad9ebfad Merge pull request #3975 from pks-t/pks/ci-improvements
CI Improvements
2016-11-01 09:59:17 +01:00
Edward Thomson
a051ee31f2 Merge pull request #3978 from pks-t/pks/doc-improvements
Small documentation improvements
2016-10-31 16:02:43 +00:00
Patrick Steinhardt
0334bf4b24 travis: do not allow valgrind failures
Our valgrind jobs haven't been failing for several builds by now.
This indicates that our tests are sufficiently stable when
running under valgrind. As such, any failures reported by
valgrind become interesting to us and shouldn't be ignored when
causing a build to fail.

Remove the valgrind job from the list of allowed failures.
2016-10-31 16:01:10 +01:00
Patrick Steinhardt
18c18e3df8 coverity: check for Coverity token only if necessary
When running a Coverity build, we have to provide an
authentication token in order to proof that we are actually
allowed to run analysis in the name of a certain project. As this
token should be secret, it is only set on the main repository, so
when we were requested to run the Coverity script on another
repository we do error out. But in fact we do also error out if
the Coverity analysis should _not_ be run if there is no
authentication token provided.

Fix the issue by only checking for the authentication token after
determining if analysis is indeed requested.
2016-10-31 16:01:10 +01:00
Patrick Steinhardt
dc98cb28db openssl_stream: fix typo 2016-10-31 13:50:23 +01:00
Patrick Steinhardt
59665db3b3 PROJECTS: consistently quote directories 2016-10-31 13:50:13 +01:00
Patrick Steinhardt
ea9ea6ac4a Documentation: fix small typos 2016-10-31 13:49:52 +01:00
Patrick Steinhardt
95fa38802f pqueue: resolve possible NULL pointer dereference
The `git_pqueue` struct allows being fixed in its total number of
entries. In this case, we simply throw away items that are
inserted into the priority queue by examining wether the new item
to be inserted has a higher priority than the previous smallest
one.

This feature somewhat contradicts our pqueue implementation in
that it is allowed to not have a comparison function. In fact, we
also fail to check if the comparison function is actually set in
the case where we add a new item into a fully filled fixed-size
pqueue.

As we cannot determine which item is the smallest item in absence
of a comparison function, we fix the `NULL` pointer dereference
by simply dropping all new items which are about to be inserted
into a full fixed-size pqueue.
2016-10-28 16:19:24 +02:00
Patrick Steinhardt
561276eed6 coverity: only analyze the master branch of the main repository
We used to only execute Coverity analysis on the 'development'
branch before commit 998f001 (Refine build limitation,
2014-01-15), which refined Coverity build limitations. While we
do not really use the 'development' branch anymore, it does
still make sense to only analyze a single branch, as otherwise
Coverity might get confused.

Re-establish the restriction such that we only analyze libgit2's
'master' branch. Also fix the message announcing why we do not
actually analyze a certain build.
2016-10-28 14:56:10 +02:00
Patrick Steinhardt
6c4d2d3ea2 coverity: fix download URL 2016-10-28 14:45:55 +02:00
Patrick Steinhardt
e3298a3308 Merge pull request #3973 from pks-t/pks/memleak-fixes
Trivial memory leak fixes in test suite
2016-10-28 12:30:39 +02:00
Patrick Steinhardt
30a876cda6 tests: fetchhead: fix memory leak 2016-10-27 11:29:15 +02:00
Patrick Steinhardt
61ad9bcd38 tests: vector: fix memory leak 2016-10-27 11:26:52 +02:00
Carlos Martín Nieto
67dd314086 Merge pull request #3966 from vivaladav/documentation-fixes
patch: minor documentation fix.
2016-10-16 12:57:29 +02:00
Davide Coppola
6d8ecf087c patch: minor documentation fix.
Fix @return description of git_patch_num_lines_in_hunk.
2016-10-16 00:43:27 +01:00
Igor Gnatenko
feb330d50d add support for OpenSSL 1.1.0 for BIO filter
Closes: https://github.com/libgit2/libgit2/issues/3959
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-10-12 12:41:43 +02:00
Patrick Steinhardt
dcd759b829 Merge pull request #3897 from pks-t/pks/squelch-example-warnings
Squelch example warnings, enable CI
2016-10-10 09:25:49 +02:00
Patrick Steinhardt
ec3f5a9c20 script: cibuild: build examples 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
fc29391950 examples: add: fix type casting warning 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
5c2a8361d7 examples: diff: parse correct types for line-diffopts 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
7314da1055 examples: fix warnings in network/fetch.c 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
e2d1b7ecbf examples: general: fix remaining warnings 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
662eee1541 examples: general: convert C99 comments to C90 comments 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
c313e3d986 examples: general: extract function demonstrating OID parsing 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
29d9afc0fb examples: general: extract function demonstrating ODB 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
b009adad35 examples: general: extract function demonstrating commit writing 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
15960454c5 examples: general: extract functions demonstrating object parsing 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
8b93ccdf08 examples: general: extract function demonstrating revwalking 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
c079e3c847 examples: general: extract function demonstrating index walking 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
f9a7973dd9 examples: general: extract function demonstrating reference listings 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
986913f45b examples: general: extract function demonstrating config files 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
176d58bad4 examples: general: use tabs instead of spaces 2016-10-10 09:04:41 +02:00
Josh Leeb-du Toit
ba3a8304ab Remove set of submodule update checkout_strategy
Remove overriding the `checkout_strategy` for `update_options` when
performing an update on a submodule. Users should be specifying the
correct checkout strategy in
`update_options.checkout_opts.checkout_strategy`.
2016-10-10 09:50:24 +11:00
Josh Leeb-du Toit
3e22bb71f2 Update submodule update opts init as per code review
Update the `GIT_SUBMODULE_UPDATE_OPTIONS_INIT` definition with the
correct values after removing `clone_checkout_strategy` in
`git_submodule_update_options`.
2016-10-10 09:50:24 +11:00
Josh Leeb-du Toit
dc976e72e9 Reword CHANGELOG entry as per code review 2016-10-10 09:50:24 +11:00
Josh Leeb-du Toit
567fd782d9 Remove clone_checkout_strategy in submodule update opts
Remove `clone_checkout_strategy` in `git_submodule_update_options` as
per issue #3784.
2016-10-10 09:50:24 +11:00
Edward Thomson
610cff13a3 Merge branch 'pr/3809' 2016-10-09 16:05:48 +01:00
Sim Domingo
dc5cfdbab9 make git_diff_stats_to_buf not show 0 insertions or 0 deletions 2016-10-09 16:03:00 +01:00
Edward Thomson
2468bf0615 Merge pull request #3958 from libgit2/ethomson/settings_docs
docs: GIT_OPT_ENABLE_STRICT_OBJECT_CREATION is enabled
2016-10-09 15:45:20 +01:00
Edward Thomson
aae8953496 Merge pull request #3956 from pks-t/pks/object-parsing-hardening
Object parsing hardening
2016-10-09 12:51:48 +01:00
Patrick Steinhardt
a719ef5e6d commit: always initialize commit message
When parsing a commit, we will treat all bytes left after parsing
the headers as the commit message. When no bytes are left, we
leave the commit's message uninitialized. While uncommon to have
a commit without message, this is the right behavior as Git
unfortunately allows for empty commit messages.

Given that this scenario is so uncommon, most programs acting on
the commit message will never check if the message is actually
set, which may lead to errors. To work around the error and not
lay the burden of checking for empty commit messages to the
developer, initialize the commit message with an empty string
when no commit message is given.
2016-10-09 13:26:21 +02:00
Edward Thomson
93392cdd91 docs: GIT_OPT_ENABLE_STRICT_OBJECT_CREATION is enabled
We changed the defaults on strict object creation - it is enabled by
default.  Update the documentation to reflect that.
2016-10-09 11:27:56 +01:00
Carlos Martín Nieto
a7df4a9151 Merge pull request #3955 from arthurschreiber/arthur/fix-regcomp_l-check
Fix the existence check for `regcomp_l`.
2016-10-07 22:36:21 +02:00
Arthur Schreiber
361179786d Fix the existence check for regcomp_l.
`xlocale.h` only defines `regcomp_l` if `regex.h` was included as well.

Also change the test cases to actually test `p_regcomp` works with
a multibyte locale.
2016-10-07 12:47:04 -07:00
Edward Thomson
45dc219f65 Merge pull request #3921 from libgit2/cmn/walk-limit-enough
Improve revision walk preparation logic
2016-10-07 16:01:28 +01:00
Patrick Steinhardt
4974e3a596 tree: validate filename and OID length when parsing object
When parsing tree entries from raw object data, we do not verify
that the tree entry actually has a filename as well as a valid
object ID. Fix this by asserting that the filename length is
non-zero as well as asserting that there are at least
`GIT_OID_RAWSZ` bytes left when parsing the OID.
2016-10-07 09:18:55 +02:00
Carlos Martín Nieto
fedc05c89c revwalk: don't show commits that become uninteresting after being enqueued
When we read from the list which `limit_list()` gives us, we need to check that
the commit is still interesting, as it might have become uninteresting after it
was added to the list.
2016-10-06 18:13:34 +02:00
Carlos Martín Nieto
d11fcf867b Merge pull request #3953 from arthurschreiber/arthur/fix-regcomp-locale-issues
Make sure we use the `C` locale for `regcomp` on macOS.
2016-10-06 14:57:11 +02:00
Arthur Schreiber
ab96ca5572 Make sure we use the C locale for regcomp on macOS. 2016-10-06 13:15:31 +02:00