Commit Graph

13046 Commits

Author SHA1 Message Date
Patrick Steinhardt
3f066a2021 gitignore: clean up patterns from old times
The gitignore file currently has a lot of patterns for files that we
shouldn't write anymore since we have migrated to CMake, as everybody is
expected to do out-of-source builds anyway. Let's remove them.
2020-03-30 15:50:14 +02:00
Edward Thomson
dd43571136 Merge pull request #5456 from pks-t/pks/refdb-fs-backend-version
refdb_fs: initialize backend version
2020-03-23 10:41:34 +00:00
Edward Thomson
43fb0c2925 Merge pull request #5444 from josharian/issue5428
repository: improve commondir docs
2020-03-23 10:20:46 +00:00
Patrick Steinhardt
a2d3316a2b refdb_fs: initialize backend version
While the `git_refdb_backend()` struct has a version, we do not
initialize it correctly when calling `git_refdb_backend_fs()`. Fix this
by adding the call to `git_refdb_init_backend()`.
2020-03-22 16:23:47 +01:00
Edward Thomson
9a1024465c Merge pull request #5455 from pks-t/pks/cmake-install-dirs
cmake: use install directories provided via GNUInstallDirs
2020-03-21 16:49:44 +00:00
Edward Thomson
44372ce53a Merge pull request #5451 from pks-t/pks/docker-curl
azure: fix errors due to curl and removal of old VM images
2020-03-18 14:36:04 +00:00
Edward Thomson
153199aeb4 ci: don't use --insecure
mbedTLS has fixed their certificate.  🎉
2020-03-17 09:42:41 +00:00
Patrick Steinhardt
87fc539f2e cmake: use install directories provided via GNUInstallDirs
We currently hand-code logic to configure where to install our artifacts
via the `LIB_INSTALL_DIR`, `INCLUDE_INSTALL_DIR` and `BIN_INSTALL_DIR`
variables. This is reinventing the wheel, as CMake already provide a way
to do that via `CMAKE_INSTALL_<DIR>` paths, e.g. `CMAKE_INSTALL_LIB`.
This requires users of libgit2 to know about the discrepancy and will
require special hacks for any build systems that handle these variables
in an automated way. One such example is Gentoo Linux, which sets up
these paths in both the cmake and cmake-utils eclass.

So let's stop doing that: the GNUInstallDirs module handles it in a
better way for us, especially so as the actual values are dependent on
CMAKE_INSTALL_PREFIX. This commit removes our own set of variables and
instead refers users to use the standard ones.

As a second benefit, this commit also fixes our pkgconfig generation to
use the GNUInstallDirs module. We had a bug there where we ignored the
CMAKE_INSTALL_PREFIX when configuring the libdir and includedir keys, so
if libdir was set to "lib64", then libdir would be an invalid path. With
GNUInstallDirs, we can now use `CMAKE_INSTALL_FULL_LIBDIR`, which
handles the prefix for us.
2020-03-14 11:18:20 +01:00
Patrick Steinhardt
8621bdda58 azure: docker: use insecure flag to fix curl downloads
We currently hve some problems with our curl downloads when building
Docker images. It's not quite obvious what the problem is and they seem
to occur semi-randomly. To unblock our CI, let's add the "--insecure"
flag to curl to ignore any certificate errors. This is intended as a
temporary solution only.
2020-03-13 22:47:42 +01:00
Patrick Steinhardt
95f329b494 azure: upgrade to newer hosted VM images
Azure is phasing out old images on March 23rd 2020, but we're currently
still using them. So let's upgrade images as following:

    - Ubuntu 16.04 -> ubuntu-18.04
    - macOS 10.13 -> macOS-10.15
    - Hosted Windows machines -> vs2017-win2016

Each of them is currently the latest version. As the new Microsoft
Windows machine has upgraded to MSVS2017, we need to also adjust our
CMake generators to "Visual Studio 15 2017". As this CMake generator
doesn't accept the target platform name anymore, we instead need to set
it up via either "-A Win32" or "-A x64".

[1]: https://devblogs.microsoft.com/devops/removing-older-images-in-azure-pipelines-hosted-pools/
2020-03-13 22:47:42 +01:00
Patrick Steinhardt
5ac33ced00 azure: docurium: fix build failure due to bumped CMake requirements
Our Docurium builds currently depend on Debian Jessie, which has CMake
v3.0 available. As rugged has bumped its CMake requirements to need at
least v3.5 now, the documentation build is thus failing.

Fix this by converting our Docurium Docker image to be based on Ubuntu
Bionic. We already do base all of our images on Ubuntu, so I don't see
any sense in using Debian here. If this was only to speed up builds, we
should just go all the way and use some minimal container like Alpine
anyway.

Also remove cache busters. As we're rebuilding the image every time,
it's we really don't need them at all.
2020-03-13 22:47:42 +01:00
Patrick Steinhardt
c76c1e87ac azure: docker: consistently silence curl but show errors
We currently pass the "--silent" flag to most invocations of curl, but
in fact this does not only suppress the progress meter, but also any
errors. So let's also pass "--show-error", too.
2020-03-13 22:47:42 +01:00
Patrick Steinhardt
f2e43a8796 ntlmclient: silence deprecation warnings for CommonCrypto backend
The `CC_MD4()` function has been deprecated in macOS 10.15. Silence this
warning for now until we implement a proper fix.
2020-03-13 22:47:42 +01:00
Patrick Steinhardt
b1f6481f2d cmake: ignore deprecation notes for Secure Transport
The Secure Transport interface we're currently using has been deprecated
with macOS 10.15. As we're currently in code freeze, we cannot migrate
to newer interfaces. As such, let's disable deprecation warnings for
our "schannel.c" stream.
2020-03-13 22:47:42 +01:00
Edward Thomson
be36db28f6 Merge pull request #5435 from libgit2/ethomson/canonical
win32: don't canonicalize relative paths
2020-03-10 21:00:37 +00:00
Patrick Steinhardt
163db8f2b0 win32: test relative symlinks
Ensure that we don't canonicalize symlink targets.
2020-03-10 20:10:20 +00:00
Edward Thomson
43d7a42bdd win32: don't canonicalize symlink targets
Don't canonicalize symlink targets; our win32 path canonicalization
routines expect an absolute path.  In particular, using the path
canonicalization routines for symlink targets (introduced in commit
7d55bee6d, "win32: fix relative symlinks pointing into dirs",
2020-01-10).

Now, use the utf8 -> utf16 relative path handling functions, so that
paths like "../foo" will be translated to "..\foo".
2020-03-10 20:10:20 +00:00
Edward Thomson
f2b114ba82 win32: introduce relative path handling function
Add a function that takes a (possibly) relative UTF-8 path and emits a
UTF-16 path with forward slashes translated to backslashes.  If the
given path is, in fact, absolute, it will be translated to absolute path
handling rules.
2020-03-10 20:10:20 +00:00
Edward Thomson
fb7da15452 win32: clarify usage of path canonicalization funcs
The path canonicalization functions on win32 are intended to
canonicalize absolute paths; those with prefixes.  In other words,
things start with drive letters (`C:\`), share names (`\\server\share`),
or other prefixes (`\\?\`).

This function removes leading `..` that occur after the prefix but
before the directory/file portion (eg, turning `C:\..\..\..\foo` into
`C:\foo`).  This translation is not appropriate for local paths.
2020-03-08 18:23:29 +00:00
Josh Bleecher Snyder
a5886e9e0e repository: improve commondir docs
Fixes #5428
2020-03-07 16:05:25 -08:00
Edward Thomson
e23b8b4465 Merge pull request #5422 from pks-t/pks/cmake-booleans
CMake booleans
2020-03-06 17:13:48 +00:00
Edward Thomson
8eb1fc36b6 Merge pull request #5439 from ignatenkobrain/patch-2
Set proper pkg-config dependency for pcre2
2020-03-06 17:12:18 +00:00
Patrick Steinhardt
76e459604b Merge pull request #5432 from libgit2/ethomson/sslread
httpclient: use a 16kb read buffer for macOS
2020-03-05 04:47:44 +01:00
Edward Thomson
502e5d5126 httpclient: use a 16kb read buffer for macOS
Use a 16kb read buffer for compatibility with macOS SecureTransport.

SecureTransport `SSLRead` has the following behavior:

1. It will return _at most_ one TLS packet's worth of data, and
2. It will try to give you as much data as you asked for

This means that if you call `SSLRead` with a buffer size that is smaller
than what _it_ reads (in other words, the maximum size of a TLS packet),
then it will buffer that data for subsequent calls.  However, it will
also attempt to give you as much data as you requested in your SSLRead
call.  This means that it will guarantee a network read in the event
that it has buffered data.

Consider our 8kb buffer and a server sending us 12kb of data on an HTTP
Keep-Alive session.  Our first `SSLRead` will read the TLS packet off
the network.  It will return us the 8kb that we requested and buffer the
remaining 4kb.  Our second `SSLRead` call will see the 4kb that's
buffered and decide that it could give us an additional 4kb.  So it will
do a network read.

But there's nothing left to read; that was the end of the data.  The
HTTP server is waiting for us to provide a new request.  The server will
eventually time out, our `read` system call will return, `SSLRead` can
return back to us and we can make progress.

While technically correct, this is wildly ineffecient.  (Thanks, Tim
Apple!)

Moving us to use an internal buffer that is the maximum size of a TLS
packet (16kb) ensures that `SSLRead` will never buffer and it will
always return everything that it read (albeit decrypted).
2020-03-04 16:24:41 -08:00
Igor Gnatenko
dd704944c4 Set proper pkg-config dependency for pcre2
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
2020-03-03 11:07:09 +01:00
Edward Thomson
cd6ed4e48c Merge pull request #5437 from libgit2/ethomson/azp
ci: provide globalsign certs for bionic
2020-03-02 11:26:22 -08:00
Edward Thomson
dc55d0e8fe ci: provide globalsign certs for bionic
tls.mbed.org has neglected to send their full certificate chain.  Add
their intermediate cert manually.  🙄
2020-03-02 10:22:54 -08:00
Edward Thomson
6d25dbdc5c Merge pull request #5426 from pks-t/pks/freebsd-htobe64
deps: ntlmclient: fix htonll on big endian FreeBSD
2020-03-01 15:57:24 -08:00
Edward Thomson
8c1aef10b8 Merge pull request #5433 from libgit2/ethomson/azp
azure-pipelines: download GlobalSign's certificate manually
2020-03-01 15:56:22 -08:00
Edward Thomson
0f316d5957 ci: provide globalsign certs
tls.mbed.org has neglected to send their full certificate chain.  Add
their intermediate cert manually.  🙄
2020-03-01 15:34:44 -08:00
Patrick Steinhardt
c690136c78 deps: ntlmclient: fix htonll on big endian FreeBSD
In commit 3828ea67b (deps: ntlmclient: fix missing htonll symbols on
FreeBSD and SunOS, 2020-02-21), we've fixed compilation on BSDs due to
missing `htonll` wrappers. While we are now using `htobe64` for both
Linux and OpenBSD, we decided to use `bswap64` on FreeBSD. While correct
on little endian systems, where we will swap from little- to big-endian,
we will also do the swap on big endian systems. As a result, we do not
use network byte order on such systems.

Fix the issue by using htobe64, as well.
2020-02-26 19:34:49 +01:00
Patrick Steinhardt
a48da8fab6 Merge pull request #5417 from pks-t/pks/ntlmclient-htonll
deps: ntlmclient: fix missing htonll symbols on FreeBSD and SunOS
2020-02-25 22:49:16 +01:00
Patrick Steinhardt
ebade23333 transports: auth_ntlm: fix use of strdup/strndup
In the NTLM authentication code, we accidentally use strdup(3P) and
strndup(3P) instead of our own wrappers git__strdup and git__strndup,
respectively.

Fix the issue by using our own functions.
2020-02-24 21:49:43 +01:00
Patrick Steinhardt
3828ea67b9 deps: ntlmclient: fix missing htonll symbols on FreeBSD and SunOS
The ntlmclient dependency defines htonll on Linux-based systems, only.
As a result, non-Linux systems will run into compiler and/or linker
errors due to undefined symbols.

Fix this issue for FreeBSD, OpenBSD and SunOS/OpenSolaris by including
the proper headers and defining the symbol accordingly.
2020-02-24 21:46:41 +01:00
Patrick Steinhardt
45ed17bdf4 Merge pull request #5420 from petersalomonsen/wasm-git-links
README: add language binding link to wasm-git
2020-02-24 21:39:23 +01:00
Patrick Steinhardt
d8e71cb2b2 cmake: fix ENABLE_TRACE parameter being too strict
In order to check whether tracing support should be turned on, we check
whether ENABLE_TRACE equals "ON". This is being much too strict, as
CMake will also treat "on", "true", "yes" and others as true-ish, but
passing them will disable tracing support now.

Fix the issue by simply removing the STREQUAL, which will cause CMake to
do the right thing automatically.
2020-02-24 21:17:27 +01:00
Patrick Steinhardt
41b6d30c5f cmake: sanitize boolean options passed by user
Starting with our conversions to mix backend-autodetection and selection
into a single variable (USE_GSSAPI, USE_HTTPS, USE_SHA1), we have
introduced a simple STREQUAL to check for "ON", which indicates that the
user wants us to auto-detect available backends and pick any one that's
available. This behaviour deviates from previous behaviour, as passing a
value like "yes", "on" or "true" will in fact be treated like a backend
name and result in autodetection failure.

Fix the issue by introducing a new function `SanitizeBool`. Given a
variable that may hold a boolean value, the function will sanitize that
variable to hold either "ON" or "OFF". In case it is not a recognized
boolean, we will just keep the value as-is. This fixes the above
described issue.
2020-02-24 21:17:27 +01:00
Peter Salomonsen
d91c6edaf1 README: add language binding link to wasm-git 2020-02-23 18:26:47 +01:00
Patrick Steinhardt
705f4e85ba Merge pull request #5412 from kloczek/master
Fix #5410: fix installing libgit2.pc in wrong location
2020-02-21 11:34:41 +01:00
Patrick Steinhardt
de1865fc9b Merge pull request #5413 from csware/nsectypo
Fix typo on GIT_USE_NEC
2020-02-21 11:10:05 +01:00
Sven Strickroth
ff46c5d316 Fix typo on GIT_USE_NEC
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2020-02-20 20:47:22 +01:00
Patrick Steinhardt
813702617f Merge pull request #5374 from pks-t/pks/diff-with-empty-subtree
tests: diff: verify that we are able to diff with empty subtrees
2020-02-19 15:57:39 +01:00
Edward Thomson
ff3297dfd1 Merge pull request #5408 from pks-t/pks/ci-cleanups
README: update our build matrix to reflect current releases
2020-02-19 14:31:55 +00:00
Edward Thomson
dabd01308b Merge pull request #5409 from libgit2/pks/coverity-fix-sudo
azure: docker: set up HOME variable to fix Coverity builds
2020-02-19 14:31:42 +00:00
Tomasz Kłoczko
fbda0575b1 Fix #5410: fix installing libgit2.pc in wrong location
Remove using custom PKG_BUILD_PREFIu, PKG_BUILD_LIBDIR and
PKG_BUILD_INCLUDEDIR variables.
Use cmake CMAKE_INSTALL_PREFIX, LIB_INSTALL_DIR, INCLUDE_INSTALL_DIR instead.
This patch fixes install libgit2.pc file in correct location and simpifies
cmake module.
2020-02-19 12:58:30 +00:00
Patrick Steinhardt
4f1923e85e Merge pull request #5390 from pks-t/pks/sha1-lookup
sha1_lookup: inline its only function into "pack.c"
2020-02-19 12:14:32 +01:00
Patrick Steinhardt
8aa04a37d1 Merge pull request #5391 from pks-t/pks/coverity-fixes
Coverity fixes
2020-02-19 12:14:16 +01:00
Patrick Steinhardt
6efe3d358b azure: docker: set up HOME variable to fix Coverity builds
In commit 01a834066 (azure: docker: fix ARM builds by replacing gosu(1),
2020-02-18), we've switched our entrypoint from gosu(1) to use sudo(1)
instead to fix our ARM builds. The switch introduced an incompatibility
that now causes our Coverity builds to fail, as the "--preserve-env"
switch will also keep HOME at its current value. As a result, Coverity
now tries to set up its configuration directory in root's home
directory, which it naturally can't write to.

Fix the issue by adding the "--set-home" flag to sudo(1).
2020-02-19 11:34:55 +01:00
Patrick Steinhardt
add54e6c2e README: update our build matrix to reflect current releases
As noted in docs/release.md, we only provide security updates for the
latest two releases. Let's thus drop the build status of both v0.27 and
v0.26 branches, adding the new v0.99 branch instead.
2020-02-19 11:31:01 +01:00
Patrick Steinhardt
172239021f Merge pull request #5291 from libgit2/ethomson/0_99
Release 0.99
v0.99.0
2020-02-19 11:27:00 +01:00