Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4282cbd

Browse files
committed
Merge remote-tracking branch 'main' into mempack_empty
2 parents 4bb69b0 + 2b74d4b commit 4282cbd

File tree

133 files changed

+5482
-692
lines changed

Some content is hidden

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

133 files changed

+5482
-692
lines changed

.github/workflows/benchmark.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Benchmark
33

44
on:
55
workflow_dispatch:
6+
inputs:
7+
suite:
8+
description: Benchmark suite to run
9+
debug:
10+
type: boolean
11+
description: Debugging output
612
schedule:
713
- cron: '15 4 * * *'
814

@@ -62,21 +68,42 @@ jobs:
6268
run: source/ci/setup-${{ matrix.platform.setup-script }}-benchmark.sh
6369
shell: bash
6470
if: matrix.platform.setup-script != ''
71+
- name: Clone resource repositories
72+
run: |
73+
mkdir resources
74+
git clone --bare https://github.com/git/git resources/git
75+
git clone --bare https://github.com/torvalds/linux resources/linux
6576
- name: Build
6677
run: |
6778
mkdir build && cd build
6879
../source/ci/build.sh
6980
shell: bash
7081
- name: Benchmark
7182
run: |
83+
export BENCHMARK_GIT_REPOSITORY="$(pwd)/resources/git"
84+
# avoid linux temporarily; the linux blame benchmarks are simply
85+
# too slow to use
86+
# export BENCHMARK_LINUX_REPOSITORY="$(pwd)/resources/linux"
87+
7288
if [[ "$(uname -s)" == MINGW* ]]; then
7389
GIT2_CLI="$(cygpath -w $(pwd))\\build\\Release\\git2"
7490
else
7591
GIT2_CLI="$(pwd)/build/git2"
7692
fi
7793
94+
if [ "${{ github.event.inputs.suite }}" != "" ]; then
95+
SUITE_FLAG="--suite ${{ github.event.inputs.suite }}"
96+
fi
97+
98+
if [ "${{ github.event.inputs.debug }}" = "true" ]; then
99+
DEBUG_FLAG="--debug"
100+
fi
101+
78102
mkdir benchmark && cd benchmark
79-
../source/tests/benchmarks/benchmark.sh --baseline-cli "git" --cli "${GIT2_CLI}" --name libgit2 --json benchmarks.json --zip benchmarks.zip
103+
../source/tests/benchmarks/benchmark.sh \
104+
${SUITE_FLAG} ${DEBUG_FLAG} \
105+
--baseline-cli "git" --cli "${GIT2_CLI}" --name libgit2 \
106+
--json benchmarks.json --zip benchmarks.zip
80107
shell: bash
81108
- name: Upload results
82109
uses: actions/upload-artifact@v4
@@ -89,7 +116,7 @@ jobs:
89116
publish:
90117
name: Publish results
91118
needs: [ build ]
92-
if: always() && github.repository == 'libgit2/libgit2'
119+
if: always() && github.repository == 'libgit2/libgit2' && github.event_name == 'schedule'
93120
runs-on: ubuntu-latest
94121
steps:
95122
- name: Check out benchmark repository
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Update the www.libgit2.org reference documentation
2+
name: Generate Documentation
3+
4+
on:
5+
push:
6+
branches: [ main, maint/* ]
7+
release:
8+
workflow_dispatch:
9+
inputs:
10+
force:
11+
description: 'Force rebuild'
12+
type: boolean
13+
required: true
14+
15+
concurrency:
16+
group: documentation
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
documentation:
23+
name: "Generate documentation"
24+
runs-on: "ubuntu-latest"
25+
steps:
26+
- name: Check out source repository
27+
uses: actions/checkout@v4
28+
with:
29+
path: source
30+
fetch-depth: 0
31+
- name: Check out documentation repository
32+
uses: actions/checkout@v4
33+
with:
34+
repository: libgit2/www.libgit2.org
35+
path: www
36+
fetch-depth: 0
37+
ssh-key: ${{ secrets.DOCS_PUBLISH_KEY }}
38+
- name: Prepare branches
39+
run: |
40+
if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then
41+
git branch --track main origin/main
42+
fi
43+
44+
for a in $(git branch -r --list 'origin/maint/*' | sed -e "s/^ origin\///"); do
45+
git branch --track "$a" "origin/$a"
46+
done
47+
working-directory: source
48+
- name: Generate documentation
49+
run: |
50+
args=""
51+
52+
if [ "${{ inputs.force }}" = "true" ]; then
53+
args="--force"
54+
fi
55+
56+
npm install
57+
./generate $args ../.. ../../../www/docs
58+
working-directory: source/script/api-docs
59+
- name: Examine changes
60+
run: |
61+
if [ -n "$(git diff --name-only)" ]; then
62+
echo "changes=true" >> $GITHUB_OUTPUT
63+
else
64+
echo "changes=false" >> $GITHUB_OUTPUT
65+
fi
66+
id: check
67+
working-directory: www
68+
- name: Publish documentation
69+
run: |
70+
DATE=$(date +"%Y-%m-%d")
71+
72+
git config user.name 'Documentation Site Generator'
73+
git config user.email '[email protected]'
74+
git add .
75+
git commit -m"Documentation update ${DATE}"
76+
git push origin main
77+
if: steps.check.outputs.changes == 'true'
78+
working-directory: www

.github/workflows/main.yml

Lines changed: 12 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
name: noble
4343
env:
4444
CC: clang
45-
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec
45+
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec -DUSE_HTTP_PARSER=http-parser
4646
CMAKE_GENERATOR: Ninja
4747
- name: "Linux (Xenial, GCC, OpenSSL, OpenSSH)"
4848
id: xenial-gcc-openssl
@@ -233,6 +233,17 @@ jobs:
233233
name: test-results-${{ matrix.platform.id }}
234234
path: build/results_*.xml
235235

236+
documentation:
237+
name: Validate documentation
238+
runs-on: ubuntu-latest
239+
steps:
240+
- name: Check out repository
241+
uses: actions/checkout@v4
242+
- name: Validate documentation
243+
run: |
244+
(cd script/api-docs && npm install)
245+
script/api-docs/api-generator.js --validate-only --strict --deprecate-hard .
246+
236247
test_results:
237248
name: Test results
238249
needs: [ build ]
@@ -245,52 +256,3 @@ jobs:
245256
uses: test-summary/action@v2
246257
with:
247258
paths: 'test-results-*/*.xml'
248-
249-
250-
# Generate documentation using docurium. We'll upload the documentation
251-
# as a build artifact so that it can be reviewed as part of a pull
252-
# request or in a forked build. For CI builds in the main repository's
253-
# main branch, we'll push the gh-pages branch back up so that it is
254-
# published to our documentation site.
255-
documentation:
256-
name: Generate documentation
257-
if: success() || failure()
258-
runs-on: ubuntu-latest
259-
steps:
260-
- name: Check out repository
261-
uses: actions/checkout@v4
262-
with:
263-
path: source
264-
fetch-depth: 0
265-
- name: Set up container
266-
uses: ./source/.github/actions/download-or-build-container
267-
with:
268-
registry: ${{ env.docker-registry }}
269-
config-path: ${{ env.docker-config-path }}
270-
container: docurium
271-
github_token: ${{ secrets.github_token }}
272-
dockerfile: ${{ matrix.platform.container.dockerfile }}
273-
- name: Generate documentation
274-
working-directory: source
275-
run: |
276-
git config user.name 'Documentation Generation'
277-
git config user.email '[email protected]'
278-
git branch gh-pages origin/gh-pages
279-
docker login https://${{ env.docker-registry }} -u ${{ github.actor }} -p ${{ github.token }}
280-
docker run \
281-
--rm \
282-
-v "$(pwd):/home/libgit2" \
283-
-w /home/libgit2 \
284-
${{ env.docker-registry }}/${{ github.repository }}/docurium:latest \
285-
cm doc api.docurium
286-
git checkout gh-pages
287-
zip --exclude .git/\* --exclude .gitignore --exclude .gitattributes -r api-documentation.zip .
288-
- uses: actions/upload-artifact@v4
289-
name: Upload artifact
290-
with:
291-
name: api-documentation
292-
path: source/api-documentation.zip
293-
- name: Push documentation branch
294-
working-directory: source
295-
run: git push origin gh-pages
296-
if: github.event_name == 'push' && github.repository == 'libgit2/libgit2'

.github/workflows/nightly.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
name: noble
4444
env:
4545
CC: clang
46-
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec
46+
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec -DUSE_HTTP_PARSER=http-parser
4747
CMAKE_GENERATOR: Ninja
4848
- name: "Linux (Xenial, GCC, OpenSSL, OpenSSH)"
4949
id: xenial-gcc-openssl
@@ -141,9 +141,9 @@ jobs:
141141
container:
142142
name: noble
143143
env:
144-
CC: clang-17
144+
CC: clang
145145
CFLAGS: -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
146-
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
146+
CMAKE_OPTIONS: -DCMAKE_C_EXTENSIONS=ON -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
147147
CMAKE_GENERATOR: Ninja
148148
SKIP_SSH_TESTS: true
149149
SKIP_NEGOTIATE_TESTS: true
@@ -156,7 +156,7 @@ jobs:
156156
container:
157157
name: noble
158158
env:
159-
CC: clang-17
159+
CC: clang
160160
CFLAGS: -fsanitize=undefined,nullability -fno-sanitize-recover=undefined,nullability -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
161161
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
162162
CMAKE_GENERATOR: Ninja
@@ -171,7 +171,7 @@ jobs:
171171
container:
172172
name: noble
173173
env:
174-
CC: clang-17
174+
CC: clang
175175
CFLAGS: -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer
176176
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
177177
CMAKE_GENERATOR: Ninja
@@ -440,7 +440,7 @@ jobs:
440440
runs-on: ubuntu-latest
441441
steps:
442442
- name: Download test results
443-
uses: actions/download-artifact@v3
443+
uses: actions/download-artifact@v4
444444
- name: Generate test summary
445445
uses: test-summary/action@v2
446446
with:

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ option(USE_THREADS "Use threads for parallel processing when possibl
3030
option(USE_NSEC "Support nanosecond precision file mtimes and ctimes" ON)
3131

3232
# Backend selection
33-
option(USE_SSH "Enable SSH support. Can be set to a specific backend" OFF)
34-
option(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
35-
option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS" ON)
36-
option(USE_SHA256 "Enable SHA256. Can be set to HTTPS/Builtin" ON)
37-
option(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
38-
set(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
33+
set(USE_SSH "" CACHE STRING "Enables SSH support and optionally selects provider. One of ON, OFF, or a specific provider: libssh2 or exec. (Defaults to OFF.)")
34+
set(USE_HTTPS "" CACHE STRING "Enable HTTPS support and optionally selects the provider. One of ON, OFF, or a specific provider: OpenSSL, OpenSSL-FIPS, OpenSSL-Dynamic, mbedTLS, SecureTransport, Schannel, or WinHTTP. (Defaults to ON.)")
35+
set(USE_SHA1 "" CACHE STRING "Selects SHA1 provider. One of CollisionDetection, HTTPS, or a specific provider. (Defaults to CollisionDetection.)")
36+
set(USE_SHA256 "" CACHE STRING "Selects SHA256 provider. One of Builtin, HTTPS, or a specific provider. (Defaults to HTTPS.)")
37+
option(USE_GSSAPI "Enable SPNEGO authentication using GSSAPI" OFF)
38+
set(USE_HTTP_PARSER "" CACHE STRING "Selects HTTP Parser support: http-parser, llhttp, or builtin. (Defaults to builtin.)")
3939
# set(USE_XDIFF "" CACHE STRING "Specifies the xdiff implementation; either system or builtin.")
40-
set(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
40+
set(REGEX_BACKEND "" CACHE STRING "Selects regex provider. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
4141
option(USE_BUNDLED_ZLIB "Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL" OFF)
4242

4343
# Debugging options
@@ -64,7 +64,7 @@ option(ENABLE_WERROR "Enable compilation with -Werror"
6464

6565
if(UNIX)
6666
# NTLM client requires crypto libraries from the system HTTPS stack
67-
if(NOT USE_HTTPS)
67+
if(USE_HTTPS STREQUAL "OFF")
6868
option(USE_NTLMCLIENT "Enable NTLM support on Unix." OFF)
6969
else()
7070
option(USE_NTLMCLIENT "Enable NTLM support on Unix." ON)

README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
libgit2 - the Git linkable library
22
==================================
3+
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9609/badge)](https://www.bestpractices.dev/projects/9609)
34

45
| Build Status | |
56
| ------------ | - |
@@ -265,29 +266,39 @@ Build options:
265266

266267
Dependency options:
267268

268-
* `USE_SSH=type`: enables SSH support; `type` can be set to `libssh2`
269-
or `exec` (which will execute an external OpenSSH command)
270-
* `USE_HTTPS=type`: enables HTTPS support; `type` can be set to
271-
`OpenSSL`, `mbedTLS`, `SecureTransport`, `Schannel`, or `WinHTTP`;
272-
the default is `SecureTransport` on macOS, `WinHTTP` on Windows, and
273-
whichever of `OpenSSL` or `mbedTLS` is detected on other platforms.
269+
* `USE_SSH=type`: enables SSH support and optionally selects the provider;
270+
`type` can be set to `libssh2` or `exec` (which will execute an external
271+
OpenSSH command). `ON` implies `libssh2`; defaults to `OFF`.
272+
* `USE_HTTPS=type`: enables HTTPS support and optionally selects the
273+
provider; `type` can be set to `OpenSSL`, `OpenSSL-Dynamic` (to not
274+
link against OpenSSL, but load it dynamically), `SecureTransport`,
275+
`Schannel` or `WinHTTP`; the default is `SecureTransport` on macOS,
276+
`WinHTTP` on Windows, and whichever of `OpenSSL` or `mbedTLS` is
277+
detected on other platforms. Defaults to `ON`.
274278
* `USE_SHA1=type`: selects the SHA1 mechanism to use; `type` can be set
275-
to `CollisionDetection` (default), or `HTTPS` to use the HTTPS
276-
driver specified above as the hashing provider.
279+
to `CollisionDetection`, `HTTPS` to use the system or HTTPS provider,
280+
or one of `OpenSSL`, `OpenSSL-Dynamic`, `OpenSSL-FIPS` (to use FIPS
281+
compliant routines in OpenSSL), `CommonCrypto`, or `Schannel`.
282+
Defaults to `CollisionDetection`. This option is retained for
283+
backward compatibility and should not be changed.
277284
* `USE_SHA256=type`: selects the SHA256 mechanism to use; `type` can be
278-
set to `HTTPS` (default) to use the HTTPS driver specified above as
279-
the hashing provider, or `Builtin`.
285+
set to `HTTPS` to use the system or HTTPS driver, `builtin`, or one of
286+
`OpenSSL`, `OpenSSL-Dynamic`, `OpenSSL-FIPS` (to use FIPS compliant
287+
routines in OpenSSL), `CommonCrypto`, or `Schannel`. Defaults to `HTTPS`.
280288
* `USE_GSSAPI=<on/off>`: enables GSSAPI for SPNEGO authentication on
281-
Unix
289+
Unix. Defaults to `OFF`.
282290
* `USE_HTTP_PARSER=type`: selects the HTTP Parser; either `http-parser`
283291
for an external
284292
[`http-parser`](https://github.com/nodejs/http-parser) dependency,
285293
`llhttp` for an external [`llhttp`](https://github.com/nodejs/llhttp)
286-
dependency, or `builtin`
294+
dependency, or `builtin`. Defaults to `builtin`.
287295
* `REGEX_BACKEND=type`: selects the regular expression backend to use;
288-
one of `regcomp_l`, `pcre2`, `pcre`, `regcomp`, or `builtin`.
289-
* `USE_BUNDLED_ZLIB=type`: selects the zlib dependency to use; one of
290-
`bundled` or `Chromium`.
296+
one of `regcomp_l`, `pcre2`, `pcre`, `regcomp`, or `builtin`. The
297+
default is to use `regcomp_l` where available, PCRE if found, otherwise,
298+
to use the builtin.
299+
* `USE_BUNDLED_ZLIB=type`: selects the bundled zlib; either `ON` or `OFF`.
300+
Defaults to using the system zlib if available, falling back to the
301+
bundled zlib.
291302

292303
Locating Dependencies
293304
---------------------

0 commit comments

Comments
 (0)