Skip to content

Commit

Permalink
Upgrade to libgit2 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavid committed Dec 30, 2024
1 parent 8f3dec8 commit e75219d
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt install tinyproxy
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.8.4 /bin/sh build.sh test
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.0 /bin/sh build.sh test
- name: macOS
if: runner.os == 'macOS'
run: |
export OPENSSL_PREFIX=`brew --prefix openssl@1.1`
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.8.4 /bin/sh build.sh test
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.0 /bin/sh build.sh test
aarch64:
runs-on: ubuntu-24.04
Expand All @@ -57,7 +57,7 @@ jobs:
apt-get update -q -y
apt-get install -q -y cmake libssl-dev python3-dev python3-venv wget
run: |
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.8.4 /bin/sh build.sh test
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.0 /bin/sh build.sh test
s390x:
runs-on: ubuntu-24.04
Expand All @@ -75,5 +75,5 @@ jobs:
apt-get update -q -y
apt-get install -q -y cmake libssl-dev python3-dev python3-venv wget
run: |
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.8.4 /bin/sh build.sh test
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.0 /bin/sh build.sh test
continue-on-error: true # Tests are expected to fail, see issue #812
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: build html

build:
OPENSSL_VERSION=3.2.3 LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.8.4 sh build.sh
OPENSSL_VERSION=3.2.3 LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.0 sh build.sh

html: build
make -C docs html
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ build_script:
# Clone, build and install libgit2
- cmd: |
set LIBGIT2=%APPVEYOR_BUILD_FOLDER%\venv
git clone --depth=1 -b v1.8.1 https://github.com/libgit2/libgit2.git libgit2
git clone --depth=1 -b v1.9.0 https://github.com/libgit2/libgit2.git libgit2
cd libgit2
cmake . -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%LIBGIT2%" -G "%GENERATOR%"
cmake --build . --target install
Expand Down
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#
# sh build.sh
#
# Build libgit2 1.8.4 (will use libssh2 if available), then build pygit2
# Build libgit2 1.9.0 (will use libssh2 if available), then build pygit2
# inplace:
#
# LIBGIT2_VERSION=1.8.4 sh build.sh
# LIBGIT2_VERSION=1.9.0 sh build.sh
#
# Build libssh2 1.11.1 and libgit2 1.8.4, then build pygit2 inplace:
# Build libssh2 1.11.1 and libgit2 1.9.0, then build pygit2 inplace:
#
# LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.8.4 sh build.sh
# LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.0 sh build.sh
#
# Build inplace and run the tests:
#
Expand Down
20 changes: 12 additions & 8 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Python requirements (these are specified in ``setup.py``):

- cffi 1.17.0 or later

Libgit2 **v1.8.x**; binary wheels already include libgit2, so you only need to
Libgit2 **v1.9.x**; binary wheels already include libgit2, so you only need to
worry about this if you install the source package.

Optional libgit2 dependecies to support ssh and https:
Expand Down Expand Up @@ -86,6 +86,10 @@ of Python and the required libgit2 version.
+-----------+----------------+------------+
| pygit2 | Python | libgit2 |
+-----------+----------------+------------+
| 1.17 | 3.10 - 3.13 | 1.9 |
+-----------+----------------+------------+
| 1.16 | 3.10 - 3.13 | 1.8 |
+-----------+----------------+------------+
| 1.15 | 3.9 - 3.12 | 1.8 |
+-----------+----------------+------------+
| 1.14 | 3.9 - 3.12 | 1.7 |
Expand Down Expand Up @@ -143,9 +147,9 @@ directory, do:

.. code-block:: sh
$ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.8.1.tar.gz -O libgit2-1.8.1.tar.gz
$ tar xzf libgit2-1.8.1.tar.gz
$ cd libgit2-1.8.1/
$ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.0.tar.gz -O libgit2-1.9.0.tar.gz
$ tar xzf libgit2-1.9.0.tar.gz
$ cd libgit2-1.9.0/
$ cmake .
$ make
$ sudo make install
Expand Down Expand Up @@ -227,9 +231,9 @@ Install libgit2 (see we define the installation prefix):

.. code-block:: sh
$ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.8.1.tar.gz -O libgit2-1.8.1.tar.gz
$ tar xzf libgit2-1.8.1.tar.gz
$ cd libgit2-1.8.1/
$ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.0.tar.gz -O libgit2-1.9.0.tar.gz
$ tar xzf libgit2-1.9.0.tar.gz
$ cd libgit2-1.9.0/
$ cmake . -DCMAKE_INSTALL_PREFIX=$LIBGIT2
$ cmake --build . --target install
Expand Down Expand Up @@ -286,7 +290,7 @@ variable. The following recipe shows you how to do it from a bash shell:
.. code-block:: sh
$ export LIBGIT2=C:/Dev/libgit2
$ git clone --depth=1 -b v1.8.1 https://github.com/libgit2/libgit2.git
$ git clone --depth=1 -b v1.9.0 https://github.com/libgit2/libgit2.git
$ cd libgit2
$ cmake . -DCMAKE_INSTALL_PREFIX=$LIBGIT2 -G "Visual Studio 14 Win64"
$ cmake --build . --config release --target install
Expand Down
3 changes: 3 additions & 0 deletions pygit2/decl/blame.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ typedef struct git_blame_hunk {
git_oid final_commit_id;
size_t final_start_line_number;
git_signature *final_signature;
git_signature *final_committer;

git_oid orig_commit_id;
const char *orig_path;
size_t orig_start_line_number;
git_signature *orig_signature;
git_signature *orig_committer;

const char *summary;
char boundary;
} git_blame_hunk;

Expand Down
1 change: 0 additions & 1 deletion pygit2/decl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ typedef struct git_config_entry {
const char *origin_path;
unsigned int include_depth;
git_config_level_t level;
void (*free)(struct git_config_entry *entry);
} git_config_entry;

void git_config_entry_free(git_config_entry *);
Expand Down
1 change: 1 addition & 0 deletions pygit2/decl/remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct git_remote_callbacks {
git_remote_ready_cb remote_ready;
void *payload;
git_url_resolve_cb resolve_url;
int (*update_refs)(const char *refname, const git_oid *a, const git_oid *b, git_refspec *spec, void *data);
};

typedef struct {
Expand Down
8 changes: 4 additions & 4 deletions pygit2/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ class BlameFlag(IntFlag):
'Normal blame, the default'

TRACK_COPIES_SAME_FILE = _pygit2.GIT_BLAME_TRACK_COPIES_SAME_FILE
'Not yet implemented and reserved for future use (as of libgit2 1.8.0).'
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'

TRACK_COPIES_SAME_COMMIT_MOVES = _pygit2.GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES
'Not yet implemented and reserved for future use (as of libgit2 1.8.0).'
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'

TRACK_COPIES_SAME_COMMIT_COPIES = _pygit2.GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES
'Not yet implemented and reserved for future use (as of libgit2 1.8.0).'
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'

TRACK_COPIES_ANY_COMMIT_COPIES = _pygit2.GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES
'Not yet implemented and reserved for future use (as of libgit2 1.8.0).'
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'

FIRST_PARENT = _pygit2.GIT_BLAME_FIRST_PARENT
'Restrict the search of commits to those reachable following only the first parents.'
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ skip = "pp3* *musllinux_aarch64 *musllinux_ppc64le"
archs = ["auto"]
build-frontend = "default"
dependency-versions = "pinned"
environment = {LIBGIT2_VERSION="1.8.4", LIBSSH2_VERSION="1.11.1", OPENSSL_VERSION="3.2.3", LIBGIT2="/project/ci"}
environment = {LIBGIT2_VERSION="1.9.0", LIBSSH2_VERSION="1.11.1", OPENSSL_VERSION="3.2.3", LIBGIT2="/project/ci"}

before-all = "sh build.sh"

Expand All @@ -21,7 +21,7 @@ repair-wheel-command = "LD_LIBRARY_PATH=/project/ci/lib auditwheel repair -w {de

[tool.cibuildwheel.macos]
archs = ["universal2"]
environment = {LIBGIT2_VERSION="1.8.4", LIBSSH2_VERSION="1.11.1", OPENSSL_VERSION="3.2.3", LIBGIT2="/Users/runner/work/pygit2/pygit2/ci"}
environment = {LIBGIT2_VERSION="1.9.0", LIBSSH2_VERSION="1.11.1", OPENSSL_VERSION="3.2.3", LIBGIT2="/Users/runner/work/pygit2/pygit2/ci"}
repair-wheel-command = "DYLD_LIBRARY_PATH=/Users/runner/work/pygit2/pygit2/ci/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"

[tool.ruff]
Expand Down
4 changes: 2 additions & 2 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include <git2.h>
#include <git2/sys/filter.h>

#if !(LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR == 8)
#error You need a compatible libgit2 version (1.8.x)
#if !(LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR == 9)
#error You need a compatible libgit2 version (1.9.x)
#endif

/*
Expand Down

0 comments on commit e75219d

Please sign in to comment.