Skip to content

Commit c978e61

Browse files
VinnyOGethomsonSven Overkcsaultorvalds
authored
upgrade libgit2 and release as 8w-2023-01-30 (#28)
* net: move url tests into util * url: remove invalid scp url parsing test The url::scp::invalid_addresses test attempts to test an invalid IPv6 address. It does not, it calls the regular URL parsing function which treats it like a possibly invalid scheme. * url: test that we don't expand % encoding in paths * url_parse: introduce our own url parsing Provide our own url parser, so that we can handle Google Code's "fun" URLs that have a userinfo with an `@` in it. :cry: * url: only allow @s in usernames for ssh urls Enforce the RFC for other protocols; Google's questionable choices about malformed SSH protocols shouldn't impact our ability to properly parse HTTPS. * push: revparse refspec source, so you can push things that are not refs I want to push a commit by OID to a remote branch. Currently, push parses the refspecs such that the source must be the name of a ref (it uses git_reference_name_to_id to resolve it). This commit changes it so push uses git_revparse_single to resolve the source of the refspec. This allows for OIDs or other revs (e.g. `HEAD~2`) to be pushed. * clone: test long custom header * winhttp: handle long custom headers * Don't fail the whole clone if you can't find a default branch In commit 6bb3587 ("clone: set refs/remotes/origin/HEAD to default branch when branch is specified, attempt 2") libgit2 was changed to set the default remote branch when one was copied. But it makes update_head_to_branch() return an error if the origin doesn't even *have* a HEAD in the first place, since git_remote_default_branch() will fail. That's entirely wrong, and means that you cannot do "git_clone()" of a particular branch on a remote repository when that remote doesn't have a default branch at all. So don't set the error code. Signed-off-by: Linus Torvalds <[email protected]> * fix compile on Windows with -DWIN32_LEAN_AND_MEAN ensure the needed wincrypt.h is included * Fix libgit2#6365 * Fix memory leak Signed-off-by: Sven Strickroth <[email protected]> * libgit2#6366: When a worktree is missing, return GIT_ENOTFOUND. * Delete create.c.bak * ci: move to macos-11 GitHub has deprecated macOS 10.15; move to their new macOS 11 build servers. * ci: clean up daemon processes on exit We previously (correctly) cleaned up the git daemon and SSH server, but failed to clean up our bespoke HTTP server and HTTP proxies. Capture their PIDs on process creation and kill them when we shut down. * clone: narrow success tests on HEAD-less remotes Only allow the remote default branch checking to fail when the remote default branch doesn't exist (`git_remote__default_branch` returns `GIT_ENOTFOUND`). If there was any other type of error - for example, an allocation failure - we should not swallow that and continue to fail. This allows us to support the case when a remote has not advertised a HEAD -- this is possible, for example, when the remote has constrained the caller to a particular namespace. But other remote failures remain as failures. * clone: test bare clone namespaced repo with no HEAD Test that we can successfully clone a repository that is namespace scoped to a bare repository locally. We need not specify a checkout branch in this case (obviously, since we do not check anything out in a bare clone). * clone: test for cloning a repo with namespace scope Test that we can successfully clone a repository that is namespace scoped on the remote and does not advertise a HEAD. To do this, we must specify the branch to checkout. * Update src/util/rand.c * tests: skip sha256 tests when not compiled in Actually `cl_skip` the sha256 tests when we're not compiled for sha256, instead of passing them. * cmake: provide empty experimental.h for non-cmake users Not everybody builds libgit2 using cmake; provide an `experimental.h` with no experiments configured for those that do not. To support this, we also now create compile definitions for experimental functionality, to supplant that empty `experimental.h`. cmake will continue to generate the proper `experimental.h` file for use with `make install`. * repo: test ownership validation fails with expected error * repo: ignore missing 'safe.directory' config during ownership checks * add 2-clause BSD license to COPYING The `git_fs_path_basename_r()` function in `src/util/fs_path.c` says it's based on Android code using the 2-clause BSD license, so I suppose that means the COPYING file should include that. * benchmark: update path The path to the default CLI output has changed, update it. * http: Update httpclient options when reusing an existing connection. Httpclient internally stores a copy of the certificate_check callback and payload. When connecting via HTTPS, and if the server sends back "Connection: close" after the first request, the following request would attempt to re-use the httpclient and call the (now outdated) callback. In particular for pygit2 this is a problem, since callbacks / payloads are only valid for the duration of a libgit2 call, leading to a ffi.from_handle() error and crashing the Python interpreter. * ssh: verify the remote's host key against known_hosts if it exists It turns out this has been available in libssh2 for a long time and we should have been verifying this the whole time. * Fix leak in git_tag_create_from_buffer If the tag already exists and we are not forcing overwrite we need to free ref_name buffer before return the "tag already exists" error. * Missing dispose * Missing dispose in git_tag_create__internal * commit-graph: only verify csum on git_commit_graph_open(). It is expensive to compute the sha1 of the entire commit-graph file each time we open it. Git only does this if it is re-writing the file. This patch will only verify the checksum when calling the external API git_commit_graph_open(), which explicitly says it opens and verifies the commit graph in the documentation. For internal library calls, we call git_commit_graph_get_file(), which mmaps the commit-graph file in read-only mode. Therefore it is safe to skip the validation check there. Tests were added to check that the validation works in the happy path, and prevents us from opening the file when validation fails. (Note from Derrick Stolee: This patch was applied internally at GitHub after we recognized the performance impact it had during an upgrade of libgit2. The original author left the company before we remembered to send it upstream.) Signed-off-by: Derrick Stolee <[email protected]> * tests: append the github.com ssh keys so we have access during tests Currently just the one test needs it. The ssh-rsa makes sure we're asking for the cipher we find in `known_hosts` as that won't be the one selected by default. This will be relevant in later changes. * tests: move online::clone::ssh_auth_methods into the ssh test suite We're currently running it as part of the online suite but that doesn't have any setup for ssh so we won't find the GitHub keys we set up during the test. It doesn't need the private key setup as we just want to make sure we see some auth request from the server, but with the addition of hostkey checking we're now seeing it fail when we skip these tests. * ssh: look for a key in known_hosts to set the key type for the handshake The server and client negotiate a single hostkey, but the "best" cipher may not be the one for which we have an entry in `known_hosts`. This can lead to us not finding the key in known_hosts even though we should be connecting. Instead here we look up the hostname with a nonsense key to perform a lookup in the known hosts and set that. This is roughly what the OpenSSH client does as well. * commit_graph: use uint64_t for arithmetic This should resolve some issues with UBSan builds by using unsigned 64-bit integers for all arithmetic until we finally convert to an offset or size value. Signed-off-by: Derrick Stolee <[email protected]> * Add support for "safe.directory *" Signed-off-by: Sven Strickroth <[email protected]> * thread: avoid warnings when building without threads `git__noop` takes no arguments, so a simple `#define func(a) git__noop` will produce warnings about the unused `a`. Introduce `git__noop_args` to swallow arguments and avoid that warning. * tests: Add new test to submodule::update Verify that trying to update submodule which has been configured but not added does return an error. Issue libgit2#6433: git_submodule_update fails to update configured but missing submodule * submodule: Do not try to update a missing submodule If a submodule has been configured but not yet added, do not try to update it. Issue libgit2#6433: git_submodule_update fails to update configured but missing submodule * transport: fix capabilities calculation This looks like a typo to me, from what i can see these lines were added at the same time and because of how capabilities are calculated, it's likely that this code will work in situations where these capabilities were the last ones. * Use `git_clone__submodule` to avoid file checks in workdir `git_clone` checks for existence of (non-empty) directories that would clash with what is about to be cloned. This is problematic when cloning submodules since they make sense in the context of a parent module, so they should not use the current working dir. Since in `git_submodule_update` we clone the submodule only when it is not yet initialized we do not need to perform directory checks. * README: show v1.5 and v1.4 branch builds * ci: update version numbers of actions * push: use resolved oid as the source 211c971 attempts to use the parsed OID but inverted the arguments to `git_oid_cpy`. * src: hide unused hmac() prototype It conflicts with NetBSD's in its libc. Closes libgit2#6457 * hash: drop all declarations from hmac The builtin hash uses the code verbatim from rfc6234, including prototypes for functions that we don't use (like hmac). Remove all unused prototypes to avoid collisions with things that an operating system might provide (like hmac). * tests: update clar test runner Update to the latest main version of clar, which includes improved xml summary output. * tests: fix clar declarations * clar: cross-platform elapsed time counter Abstract time counter for tests; use gettimeofday on Unix and GetTickCount on Windows. * ci: always create test summaries, even on failure When the dependent jobs fail -- possibly due to test failures -- we should still produce the job summary that shows those test failures. * ci: update upload-artifact dependency * ci: upgrade test-summary action * Get libgit2 working for 8thwall. (#24) Upgrade libgit2 with support for 8thwall cloud editor. --------- Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Sven Strickroth <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Co-authored-by: Edward Thomson <[email protected]> Co-authored-by: Sven Over <[email protected]> Co-authored-by: Kevin Saul <[email protected]> Co-authored-by: Linus Torvalds <[email protected]> Co-authored-by: Christoph Cullmann <[email protected]> Co-authored-by: Vinz2008 <[email protected]> Co-authored-by: Sven Strickroth <[email protected]> Co-authored-by: Miguel Arroz <[email protected]> Co-authored-by: Laurence McGlashan <[email protected]> Co-authored-by: Martin von Zweigbergk <[email protected]> Co-authored-by: Sebastian Lackner <[email protected]> Co-authored-by: Carlos Martín Nieto <[email protected]> Co-authored-by: Julian Mesa <[email protected]> Co-authored-by: Colin Stolley <[email protected]> Co-authored-by: Derrick Stolee <[email protected]> Co-authored-by: Edward Thomson <[email protected]> Co-authored-by: tagesuhu <[email protected]> Co-authored-by: Russell Sim <[email protected]> Co-authored-by: Aleš Bizjak <[email protected]> Co-authored-by: Thomas Klausner <[email protected]>
1 parent 45271d0 commit c978e61

File tree

86 files changed

+1652
-915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1652
-915
lines changed

.github/workflows/benchmark.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
os: ubuntu-latest
2828
setup-script: ubuntu
2929
- name: "macOS"
30-
os: macos-10.15
30+
os: macos-11
3131
env:
3232
CC: clang
3333
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_GSSAPI=ON -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
@@ -50,7 +50,7 @@ jobs:
5050
runs-on: ${{ matrix.platform.os }}
5151
steps:
5252
- name: Check out repository
53-
uses: actions/checkout@v2
53+
uses: actions/checkout@v3
5454
with:
5555
path: source
5656
fetch-depth: 0
@@ -66,9 +66,9 @@ jobs:
6666
- name: Benchmark
6767
run: |
6868
if [[ "$(uname -s)" == MINGW* ]]; then
69-
GIT2_CLI="$(cygpath -w $(pwd))\\build\\Release\\git2_cli"
69+
GIT2_CLI="$(cygpath -w $(pwd))\\build\\Release\\git2"
7070
else
71-
GIT2_CLI="$(pwd)/build/git2_cli"
71+
GIT2_CLI="$(pwd)/build/git2"
7272
fi
7373
7474
mkdir benchmark && cd benchmark

.github/workflows/main.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
name: "Create container: ${{ matrix.container.name }}"
4949
steps:
5050
- name: Check out repository
51-
uses: actions/checkout@v2
51+
uses: actions/checkout@v3
5252
with:
5353
path: source
5454
fetch-depth: 0
@@ -122,7 +122,7 @@ jobs:
122122
os: ubuntu-latest
123123
- name: "macOS"
124124
id: macos
125-
os: macos-10.15
125+
os: macos-11
126126
env:
127127
CC: clang
128128
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
@@ -230,7 +230,7 @@ jobs:
230230
os: ubuntu-latest
231231
- name: "macOS (SHA256)"
232232
id: macos
233-
os: macos-10.15
233+
os: macos-11
234234
env:
235235
CC: clang
236236
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DEXPERIMENTAL_SHA256=ON
@@ -253,7 +253,7 @@ jobs:
253253
name: "Build: ${{ matrix.platform.name }}"
254254
steps:
255255
- name: Check out repository
256-
uses: actions/checkout@v2
256+
uses: actions/checkout@v3
257257
with:
258258
path: source
259259
fetch-depth: 0
@@ -323,12 +323,13 @@ jobs:
323323
test_results:
324324
name: Test results
325325
needs: [ build ]
326+
if: always()
326327
runs-on: ubuntu-latest
327328
steps:
328329
- name: Download test results
329330
uses: actions/download-artifact@v3
330331
- name: Generate test summary
331-
uses: test-summary/action@v1
332+
uses: test-summary/action@v2
332333
with:
333334
paths: 'test-results-*/*.xml'
334335

@@ -345,7 +346,7 @@ jobs:
345346
runs-on: ubuntu-latest
346347
steps:
347348
- name: Check out repository
348-
uses: actions/checkout@v2
349+
uses: actions/checkout@v3
349350
with:
350351
path: source
351352
fetch-depth: 0
@@ -364,7 +365,7 @@ jobs:
364365
cm doc api.docurium
365366
git checkout gh-pages
366367
zip --exclude .git/\* --exclude .gitignore --exclude .gitattributes -r api-documentation.zip .
367-
- uses: actions/upload-artifact@v2
368+
- uses: actions/upload-artifact@v3
368369
name: Upload artifact
369370
with:
370371
name: api-documentation

.github/workflows/nightly.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
SKIP_SSH_TESTS: true
155155
os: ubuntu-latest
156156
- name: "macOS"
157-
os: macos-10.15
157+
os: macos-11
158158
env:
159159
CC: clang
160160
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
@@ -271,7 +271,7 @@ jobs:
271271
runs-on: ${{ matrix.platform.os }}
272272
steps:
273273
- name: Check out repository
274-
uses: actions/checkout@v2
274+
uses: actions/checkout@v3
275275
with:
276276
path: source
277277
fetch-depth: 0
@@ -333,7 +333,7 @@ jobs:
333333
runs-on: ubuntu-latest
334334
steps:
335335
- name: Check out repository
336-
uses: actions/checkout@v2
336+
uses: actions/checkout@v3
337337
with:
338338
path: source
339339
fetch-depth: 0
@@ -358,13 +358,13 @@ jobs:
358358
runs-on: ubuntu-latest
359359
steps:
360360
- name: Check out repository
361-
uses: actions/checkout@v2
361+
uses: actions/checkout@v3
362362
with:
363363
fetch-depth: 0
364364

365365
# Initializes the CodeQL tools for scanning.
366366
- name: Initialize CodeQL
367-
uses: github/codeql-action/init@v1
367+
uses: github/codeql-action/init@v2
368368
with:
369369
languages: 'cpp'
370370

@@ -376,4 +376,4 @@ jobs:
376376
cmake --build .
377377
378378
- name: Perform CodeQL Analysis
379-
uses: github/codeql-action/analyze@v1
379+
uses: github/codeql-action/analyze@v2

COPYING

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,3 +1184,33 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
11841184
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11851185
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11861186

1187+
----------------------------------------------------------------------
1188+
1189+
The built-in git_fs_path_basename_r() function is based on the
1190+
Android implementation, BSD licensed:
1191+
1192+
Copyright (C) 2008 The Android Open Source Project
1193+
All rights reserved.
1194+
1195+
Redistribution and use in source and binary forms, with or without
1196+
modification, are permitted provided that the following conditions
1197+
are met:
1198+
* Redistributions of source code must retain the above copyright
1199+
notice, this list of conditions and the following disclaimer.
1200+
* Redistributions in binary form must reproduce the above copyright
1201+
notice, this list of conditions and the following disclaimer in
1202+
the documentation and/or other materials provided with the
1203+
distribution.
1204+
1205+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1206+
AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1207+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1208+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1209+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1210+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1211+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
1212+
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
1213+
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1214+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
1215+
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1216+
SUCH DAMAGE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ libgit2 - the Git linkable library
44
| Build Status | |
55
| ------------ | - |
66
| **main** branch CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush) |
7+
| **v1.5 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.5&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.5) |
78
| **v1.4 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.4&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.4) |
8-
| **v1.3 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.3&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.3) |
99
| **Nightly** builds | [![Nightly Build](https://github.com/libgit2/libgit2/workflows/Nightly%20Build/badge.svg)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22Nightly+Build%22) [![Coverity Scan Status](https://scan.coverity.com/projects/639/badge.svg)](https://scan.coverity.com/projects/639) |
1010

1111
`libgit2` is a portable, pure C implementation of the Git core methods

ci/test.sh

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,33 @@ CONTINUE_ON_FAILURE=0
2222
cleanup() {
2323
echo "Cleaning up..."
2424

25-
if [ ! -z "$GITDAEMON_PID" ]; then
26-
echo "Stopping git daemon..."
27-
kill $GITDAEMON_PID
25+
if [ ! -z "$GIT_STANDARD_PID" ]; then
26+
echo "Stopping git daemon (standard)..."
27+
kill $GIT_STANDARD_PID
28+
fi
29+
30+
if [ ! -z "$GIT_NAMESPACE_PID" ]; then
31+
echo "Stopping git daemon (namespace)..."
32+
kill $GIT_NAMESPACE_PID
33+
fi
34+
35+
if [ ! -z "$PROXY_BASIC_PID" ]; then
36+
echo "Stopping proxy (Basic)..."
37+
kill $PROXY_BASIC_PID
38+
fi
39+
40+
if [ ! -z "$PROXY_NTLM_PID" ]; then
41+
echo "Stopping proxy (NTLM)..."
42+
kill $PROXY_NTLM_PID
43+
fi
44+
45+
if [ ! -z "$HTTP_PID" ]; then
46+
echo "Stopping HTTP server..."
47+
kill $HTTP_PID
2848
fi
2949

3050
if [ ! -z "$SSHD_DIR" -a -f "${SSHD_DIR}/pid" ]; then
31-
echo "Stopping SSH..."
51+
echo "Stopping SSH server..."
3252
kill $(cat "${SSHD_DIR}/pid")
3353
fi
3454

@@ -80,40 +100,46 @@ echo "##########################################################################
80100
echo "## Configuring test environment"
81101
echo "##############################################################################"
82102

103+
echo ""
104+
83105
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
84-
echo "Starting git daemon..."
85-
GITDAEMON_DIR=`mktemp -d ${TMPDIR}/gitdaemon.XXXXXXXX`
86-
git init --bare "${GITDAEMON_DIR}/test.git" >/dev/null
87-
git daemon --listen=localhost --export-all --enable=receive-pack --base-path="${GITDAEMON_DIR}" "${GITDAEMON_DIR}" 2>/dev/null &
88-
GITDAEMON_PID=$!
89-
disown $GITDAEMON_PID
106+
echo "Starting git daemon (standard)..."
107+
GIT_STANDARD_DIR=`mktemp -d ${TMPDIR}/git_standard.XXXXXXXX`
108+
git init --bare "${GIT_STANDARD_DIR}/test.git" >/dev/null
109+
git daemon --listen=localhost --export-all --enable=receive-pack --base-path="${GIT_STANDARD_DIR}" "${GIT_STANDARD_DIR}" 2>/dev/null &
110+
GIT_STANDARD_PID=$!
111+
112+
echo "Starting git daemon (namespace)..."
113+
GIT_NAMESPACE_DIR=`mktemp -d ${TMPDIR}/git_namespace.XXXXXXXX`
114+
cp -R "${SOURCE_DIR}/tests/resources/namespace.git" "${GIT_NAMESPACE_DIR}/namespace.git"
115+
GIT_NAMESPACE="name1" git daemon --listen=localhost --port=9419 --export-all --enable=receive-pack --base-path="${GIT_NAMESPACE_DIR}" "${GIT_NAMESPACE_DIR}" &
116+
GIT_NAMESPACE_PID=$!
90117
fi
91118

92119
if [ -z "$SKIP_PROXY_TESTS" ]; then
93120
curl --location --silent --show-error https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar
94121

95-
echo ""
96122
echo "Starting HTTP proxy (Basic)..."
97123
java -jar poxyproxy.jar --address 127.0.0.1 --port 8080 --credentials foo:bar --auth-type basic --quiet &
124+
PROXY_BASIC_PID=$!
98125

99-
echo ""
100126
echo "Starting HTTP proxy (NTLM)..."
101127
java -jar poxyproxy.jar --address 127.0.0.1 --port 8090 --credentials foo:bar --auth-type ntlm --quiet &
128+
PROXY_NTLM_PID=$!
102129
fi
103130

104131
if [ -z "$SKIP_NTLM_TESTS" -o -z "$SKIP_ONLINE_TESTS" ]; then
105132
curl --location --silent --show-error https://github.com/ethomson/poxygit/releases/download/v0.5.1/poxygit-0.5.1.jar >poxygit.jar
106133

107-
echo ""
108134
echo "Starting HTTP server..."
109-
NTLM_DIR=`mktemp -d ${TMPDIR}/ntlm.XXXXXXXX`
110-
git init --bare "${NTLM_DIR}/test.git"
111-
java -jar poxygit.jar --address 127.0.0.1 --port 9000 --credentials foo:baz --quiet "${NTLM_DIR}" &
135+
HTTP_DIR=`mktemp -d ${TMPDIR}/http.XXXXXXXX`
136+
git init --bare "${HTTP_DIR}/test.git"
137+
java -jar poxygit.jar --address 127.0.0.1 --port 9000 --credentials foo:baz --quiet "${HTTP_DIR}" &
138+
HTTP_PID=$!
112139
fi
113140

114141
if [ -z "$SKIP_SSH_TESTS" ]; then
115-
echo ""
116-
echo "Starting ssh daemon..."
142+
echo "Starting SSH server..."
117143
HOME=`mktemp -d ${TMPDIR}/home.XXXXXXXX`
118144
SSHD_DIR=`mktemp -d ${TMPDIR}/sshd.XXXXXXXX`
119145
git init --bare "${SSHD_DIR}/test.git" >/dev/null
@@ -144,6 +170,11 @@ if [ -z "$SKIP_SSH_TESTS" ]; then
144170
echo "[localhost]:2222 $algorithm $key" >>"${HOME}/.ssh/known_hosts"
145171
done <"${SSHD_DIR}/id_rsa.pub"
146172

173+
# Append the github.com keys for the tests that don't override checks.
174+
# We ask for ssh-rsa to test that the selection based off of known_hosts
175+
# is working.
176+
ssh-keyscan -t ssh-rsa github.com >>"${HOME}/.ssh/known_hosts"
177+
147178
# Get the fingerprint for localhost and remove the colons so we can
148179
# parse it as a hex number. Older versions have a different output
149180
# format.
@@ -214,12 +245,22 @@ fi
214245

215246
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
216247
echo ""
217-
echo "Running gitdaemon tests"
248+
echo "Running gitdaemon (standard) tests"
218249
echo ""
219250

220251
export GITTEST_REMOTE_URL="git://localhost/test.git"
221252
run_test gitdaemon
222253
unset GITTEST_REMOTE_URL
254+
255+
echo ""
256+
echo "Running gitdaemon (namespace) tests"
257+
echo ""
258+
259+
export GITTEST_REMOTE_URL="git://localhost:9419/namespace.git"
260+
export GITTEST_REMOTE_BRANCH="four"
261+
run_test gitdaemon_namespace
262+
unset GITTEST_REMOTE_URL
263+
unset GITTEST_REMOTE_BRANCH
223264
fi
224265

225266
if [ -z "$SKIP_PROXY_TESTS" ]; then

cmake/ExperimentalFeatures.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
# Experimental feature support for libgit2 - developers can opt in to
2+
# experimental functionality, like sha256 support. When experimental
3+
# functionality is enabled, we set both a cmake flag *and* a compile
4+
# definition. The cmake flag is used to generate `experimental.h`,
5+
# which will be installed by a `make install`. But the compile definition
6+
# is used by the libgit2 sources to detect the functionality at library
7+
# build time. This allows us to have an in-tree `experimental.h` with
8+
# *no* experiments enabled. This lets us support users who build without
9+
# cmake and cannot generate the `experimental.h` file.
10+
111
if(EXPERIMENTAL_SHA256)
212
add_feature_info("SHA256 API" ON "experimental SHA256 APIs")
313

414
set(EXPERIMENTAL 1)
515
set(GIT_EXPERIMENTAL_SHA256 1)
16+
add_compile_definitions(GIT_EXPERIMENTAL_SHA256)
617
else()
718
add_feature_info("SHA256 API" OFF "experimental SHA256 APIs")
819
endif()

include/git2/experimental.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (C) the libgit2 contributors. All rights reserved.
3+
*
4+
* This file is part of libgit2, distributed under the GNU GPL v2 with
5+
* a Linking Exception. For full terms see the included COPYING file.
6+
*/
7+
8+
#ifndef INCLUDE_experimental_h__
9+
#define INCLUDE_experimental_h__
10+
11+
/*
12+
* This file exists to support users who build libgit2 with a bespoke
13+
* build system and do not use our cmake configuration. Normally, cmake
14+
* will create `experimental.h` from the `experimental.h.in` file and
15+
* will include the generated file instead of this one. For non-cmake
16+
* users, we bundle this `experimental.h` file which will be used
17+
* instead.
18+
*/
19+
20+
#endif

src/cli/opt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "opt.h"
2424

2525
#ifdef _WIN32
26-
# include <Windows.h>
26+
# include <windows.h>
2727
#else
2828
# include <fcntl.h>
2929
# include <sys/ioctl.h>

src/libgit2/clone.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ static int update_head_to_branch(
282282
reflog_message)) < 0)
283283
goto cleanup;
284284

285-
if ((retcode = git_remote__default_branch(&default_branch, remote)) < 0)
285+
retcode = git_remote__default_branch(&default_branch, remote);
286+
287+
if (retcode == GIT_ENOTFOUND)
288+
retcode = 0;
289+
else if (retcode)
286290
goto cleanup;
287291

288292
if (!git_remote__matching_refspec(remote, git_str_cstr(&default_branch)))

0 commit comments

Comments
 (0)