Skip to content

Commit 3951f96

Browse files
authored
Merge branch 'libgit2:main' into main
2 parents 17a9aae + 536f868 commit 3951f96

File tree

151 files changed

+6404
-842
lines changed

Some content is hidden

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

151 files changed

+6404
-842
lines changed

.github/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ changelog:
1515
- title: Code cleanups
1616
labels:
1717
- cleanup
18+
- title: Benchmarks
19+
labels:
20+
- benchmarks
1821
- title: Build and CI improvements
1922
labels:
2023
- build
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 --verbose $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: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -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'

cmake/SelectZlib.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include(SanitizeBool)
44
SanitizeBool(USE_BUNDLED_ZLIB)
55
if(USE_BUNDLED_ZLIB STREQUAL ON)
66
set(USE_BUNDLED_ZLIB "Bundled")
7+
set(GIT_COMPRESSION_BUILTIN)
78
endif()
89

910
if(USE_BUNDLED_ZLIB STREQUAL "OFF")
@@ -17,6 +18,7 @@ if(USE_BUNDLED_ZLIB STREQUAL "OFF")
1718
list(APPEND LIBGIT2_PC_REQUIRES "zlib")
1819
endif()
1920
add_feature_info(zlib ON "using system zlib")
21+
set(GIT_COMPRESSION_ZLIB 1)
2022
else()
2123
message(STATUS "zlib was not found; using bundled 3rd-party sources." )
2224
endif()
@@ -26,9 +28,11 @@ if(USE_BUNDLED_ZLIB STREQUAL "Chromium")
2628
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/chromium-zlib")
2729
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:chromium_zlib>)
2830
add_feature_info(zlib ON "using (Chromium) bundled zlib")
31+
set(GIT_COMPRESSION_BUILTIN 1)
2932
elseif(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
3033
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/zlib" "${PROJECT_BINARY_DIR}/deps/zlib")
3134
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/zlib")
3235
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:zlib>)
3336
add_feature_info(zlib ON "using bundled zlib")
37+
set(GIT_COMPRESSION_BUILTIN 1)
3438
endif()

docs/changelog.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
v1.8.4
2+
------
3+
4+
We erroneously shipped v1.8.3 without actually including the change
5+
in v1.8.2. This release re-re-introduces the pre-v1.8.0 `commit`
6+
constness behavior.
7+
8+
## What's Changed
9+
10+
### Bug fixes
11+
12+
* Fix constness issue introduced in #6716 by @ethomson in https://github.com/libgit2/libgit2/pull/6829
13+
14+
**Full Changelog**: https://github.com/libgit2/libgit2/compare/v1.8.3...v1.8.4
15+
16+
v1.8.3
17+
------
18+
19+
This release fixes a bug introduced in v1.8.1 for users of the legacy
20+
[Node.js http-parser](https://github.com/nodejs/http-parser)
21+
dependency.
22+
23+
## What's Changed
24+
25+
### Bug fixes
26+
27+
* http: Backport on_status initialize fix for http-parser by @ethomson in https://github.com/libgit2/libgit2/pull/6931
28+
129
v1.8.2
230
------
331

examples/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int lg2_index_pack(git_repository *repo, int argc, char **argv)
2929
}
3030

3131
#ifdef GIT_EXPERIMENTAL_SHA256
32-
error = git_indexer_new(&idx, ".", git_repository_oid_type(repo), NULL);
32+
error = git_indexer_new(&idx, ".", NULL);
3333
#else
3434
error = git_indexer_new(&idx, ".", 0, NULL, NULL);
3535
#endif

examples/show-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int lg2_show_index(git_repository *repo, int argc, char **argv)
3131
dirlen = strlen(dir);
3232
if (dirlen > 5 && strcmp(dir + dirlen - 5, "index") == 0) {
3333
#ifdef GIT_EXPERIMENTAL_SHA256
34-
check_lg2(git_index_open(&index, dir, GIT_OID_SHA1), "could not open index", dir);
34+
check_lg2(git_index_open(&index, dir, NULL), "could not open index", dir);
3535
#else
3636
check_lg2(git_index_open(&index, dir), "could not open index", dir);
3737
#endif

fuzzers/packfile_fuzzer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
8484
}
8585

8686
#ifdef GIT_EXPERIMENTAL_SHA256
87-
error = git_indexer_new(&indexer, ".", GIT_OID_SHA1, NULL);
87+
error = git_indexer_new(&indexer, ".", NULL);
8888
#else
8989
error = git_indexer_new(&indexer, ".", 0, odb, NULL);
9090
#endif

include/git2/annotated_commit.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@
1313

1414
/**
1515
* @file git2/annotated_commit.h
16-
* @brief Git annotated commit routines
16+
* @brief A commit and information about how it was looked up by the user.
1717
* @defgroup git_annotated_commit Git annotated commit routines
1818
* @ingroup Git
19+
*
20+
* An "annotated commit" is a commit that contains information about
21+
* how the commit was resolved, which can be used for maintaining the
22+
* user's "intent" through commands like merge and rebase. For example,
23+
* if a user wants to "merge HEAD" then an annotated commit is used to
24+
* both contain the HEAD commit _and_ the fact that it was resolved as
25+
* the HEAD ref.
1926
* @{
2027
*/
2128
GIT_BEGIN_DECL
@@ -25,7 +32,7 @@ GIT_BEGIN_DECL
2532
* The resulting git_annotated_commit must be freed with
2633
* `git_annotated_commit_free`.
2734
*
28-
* @param out pointer to store the git_annotated_commit result in
35+
* @param[out] out pointer to store the git_annotated_commit result in
2936
* @param repo repository that contains the given reference
3037
* @param ref reference to use to lookup the git_annotated_commit
3138
* @return 0 on success or error code
@@ -40,7 +47,7 @@ GIT_EXTERN(int) git_annotated_commit_from_ref(
4047
* The resulting git_annotated_commit must be freed with
4148
* `git_annotated_commit_free`.
4249
*
43-
* @param out pointer to store the git_annotated_commit result in
50+
* @param[out] out pointer to store the git_annotated_commit result in
4451
* @param repo repository that contains the given commit
4552
* @param branch_name name of the (remote) branch
4653
* @param remote_url url of the remote
@@ -67,7 +74,7 @@ GIT_EXTERN(int) git_annotated_commit_from_fetchhead(
6774
* most specific function (eg `git_annotated_commit_from_ref`)
6875
* instead of this one when that data is known.
6976
*
70-
* @param out pointer to store the git_annotated_commit result in
77+
* @param[out] out pointer to store the git_annotated_commit result in
7178
* @param repo repository that contains the given commit
7279
* @param id the commit object id to lookup
7380
* @return 0 on success or error code
@@ -84,7 +91,7 @@ GIT_EXTERN(int) git_annotated_commit_lookup(
8491
* http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
8592
* information on the syntax accepted.
8693
*
87-
* @param out pointer to store the git_annotated_commit result in
94+
* @param[out] out pointer to store the git_annotated_commit result in
8895
* @param repo repository that contains the given commit
8996
* @param revspec the extended sha syntax string to use to lookup the commit
9097
* @return 0 on success or error code

include/git2/apply.h

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414

1515
/**
1616
* @file git2/apply.h
17-
* @brief Git patch application routines
17+
* @brief Apply patches to the working directory or index
1818
* @defgroup git_apply Git patch application routines
1919
* @ingroup Git
20+
*
21+
* Mechanisms to apply a patch to the index, the working directory,
22+
* or both.
2023
* @{
2124
*/
2225
GIT_BEGIN_DECL
@@ -57,7 +60,15 @@ typedef int GIT_CALLBACK(git_apply_hunk_cb)(
5760
const git_diff_hunk *hunk,
5861
void *payload);
5962

60-
/** Flags controlling the behavior of git_apply */
63+
/**
64+
* Flags controlling the behavior of `git_apply`.
65+
*
66+
* When the callback:
67+
* - returns < 0, the apply process will be aborted.
68+
* - returns > 0, the hunk will not be applied, but the apply process
69+
* continues
70+
* - returns 0, the hunk is applied, and the apply process continues.
71+
*/
6172
typedef enum {
6273
/**
6374
* Don't actually make changes, just test that the patch applies.
@@ -67,12 +78,19 @@ typedef enum {
6778
} git_apply_flags_t;
6879

6980
/**
70-
* Apply options structure
81+
* Apply options structure.
82+
*
83+
* When the callback:
84+
* - returns < 0, the apply process will be aborted.
85+
* - returns > 0, the hunk will not be applied, but the apply process
86+
* continues
87+
* - returns 0, the hunk is applied, and the apply process continues.
7188
*
7289
* Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can
7390
* use `git_apply_options_init`.
7491
*
75-
* @see git_apply_to_tree, git_apply
92+
* @see git_apply_to_tree
93+
* @see git_apply
7694
*/
7795
typedef struct {
7896
unsigned int version; /**< The version */
@@ -83,14 +101,17 @@ typedef struct {
83101
/** When applying a patch, callback that will be made per hunk. */
84102
git_apply_hunk_cb hunk_cb;
85103

86-
/** Payload passed to both delta_cb & hunk_cb. */
104+
/** Payload passed to both `delta_cb` & `hunk_cb`. */
87105
void *payload;
88106

89-
/** Bitmask of git_apply_flags_t */
107+
/** Bitmask of `git_apply_flags_t` */
90108
unsigned int flags;
91109
} git_apply_options;
92110

111+
/** Current version for the `git_apply_options` structure */
93112
#define GIT_APPLY_OPTIONS_VERSION 1
113+
114+
/** Static constructor for `git_apply_options` */
94115
#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
95116

96117
/**

0 commit comments

Comments
 (0)