Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgit2: 1.8.4 -> 1.9.0 (also pygit2 update) #373096

Open
wants to merge 11 commits into
base: staging
Choose a base branch
from
10 changes: 9 additions & 1 deletion pkgs/by-name/ca/cargo-generate/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
rustPlatform,
fetchFromGitHub,
fetchpatch,
pkg-config,
libgit2,
openssl,
Expand All @@ -21,7 +22,14 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-iOZCSd6jF1OF7ScjpsMlvMjsFHyg6QJJ6qk0OxrARho=";
};

cargoHash = "sha256-ZLzJpD3bIuNtGl5kzhvpE07jtfEV+lgnTiPcFM7MHdE=";
cargoPatches = [
(fetchpatch {
name = "git2-version.patch";
url = "https://github.com/cargo-generate/cargo-generate/commit/be2237177ee7ae996e2991189b07a5d211cd0d01.patch";
hash = "sha256-F/o1EeDBfRhIB8atpOHoc6ZnUFCyD1QkCERv4m/YeWE=";
})
];
cargoHash = "sha256-SNqKUwx0P4GvsJqvlY9XvcbcnbY5j6fMxHD6ZmC2apE=";

nativeBuildInputs = [ pkg-config ];

Expand Down
8 changes: 5 additions & 3 deletions pkgs/by-name/ca/cargo-update/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@

rustPlatform.buildRustPackage rec {
pname = "cargo-update";
version = "16.0.0";
version = "16.1.0";

src = fetchCrate {
inherit pname version;
hash = "sha256-jLv/9Fvg+1HNIhfm0D/vvMR9J+Enztj9rXQE1kZITGI=";
hash = "sha256-bdIFenNMW5iDQaKS2+lMYVVfc0zpbYNOHQqczpjBNC4=";
};

cargoHash = "sha256-rwXpQkL6ysMBraLIMk2zQe0vmb9uuePWufBjRVzaBOA=";
useFetchCargoVendor = true;

cargoHash = "sha256-KujJB9o5+yHu6mEQOvzGUcBS6/fh/jcnt7/FbUPLefg=";

nativeBuildInputs =
[
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ge/gex/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rustPlatform.buildRustPackage rec {
./patch-libgit2.patch
];

cargoHash = "sha256-GEQ4Zv14Dzo9mt1YIDmXEBHLPD6G0/O1ggmUTnSYD+k=";
cargoHash = "sha256-Y6xsGGYc8gTEAZF7i60ERZUKjECuUTxdY3uK5zEKwr8=";

meta = with lib; {
description = "Git Explorer: cross-platform git workflow improvement tool inspired by Magit";
Expand Down
10 changes: 5 additions & 5 deletions pkgs/by-name/ge/gex/patch-libgit2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ index 5101c2e..0cb59d2 100644
[[package]]
name = "git2"
-version = "0.18.1"
+version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd"
+checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
+checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff"
dependencies = [
"bitflags 2.3.3",
"libc",
Expand All @@ -29,10 +29,10 @@ index 5101c2e..0cb59d2 100644
[[package]]
name = "libgit2-sys"
-version = "0.16.1+1.7.1"
+version = "0.17.0+1.8.1"
+version = "0.18.0+1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c"
+checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
+checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec"
dependencies = [
"cc",
"libc",
Expand All @@ -45,7 +45,7 @@ index 26cef3f..f947945 100644
crossterm = { version = "0.27.0", features = ["serde"] }
dirs = "5.0.1"
-git2 = { version = "0.18.1", default-features = false }
+git2 = { version = "0.19.0", default-features = false }
+git2 = { version = "0.20.0", default-features = false }
itertools = "0.11.0"
nom = "7.1.3"
paste = "1.0.14"
Expand Down
52 changes: 52 additions & 0 deletions pkgs/by-name/ju/jujutsu/libgit2-1.9.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From b4f936ac302ee835aa274e4dd186b436781d5d2f Mon Sep 17 00:00:00 2001
From: Rui Chen <[email protected]>
Date: Thu, 9 Jan 2025 09:51:47 -0500
Subject: [PATCH] chore(deps): update git2 to use libgit2 1.9

Signed-off-by: Rui Chen <[email protected]>
---
Cargo.lock | 8 ++++----
Cargo.toml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 69398f4d6d..3ec8dfdacc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -913,9 +913,9 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"

[[package]]
name = "git2"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
+checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff"
dependencies = [
"bitflags",
"libc",
@@ -2109,9 +2109,9 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"

[[package]]
name = "libgit2-sys"
-version = "0.17.0+1.8.1"
+version = "0.18.0+1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
+checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec"
dependencies = [
"cc",
"libc",
diff --git a/Cargo.toml b/Cargo.toml
index 0fc4393cb5..b955fd6aa1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,7 +46,7 @@ dirs = "5.0.1"
dunce = "1.0.5"
either = "1.13.0"
futures = "0.3.31"
-git2 = { version = "0.19.0", features = [
+git2 = { version = "0.20.0", features = [
# Do *not* disable this feature even if you'd like dynamic linking. Instead,
# set the environment variable `LIBGIT2_NO_VENDOR=1` if dynamic linking must
# be used (this will override the Cargo feature), and allow static linking
7 changes: 6 additions & 1 deletion pkgs/by-name/ju/jujutsu/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ rustPlatform.buildRustPackage {
hash = "sha256-5J1ZfPNyniUK5D3Pt1aKuJ+/8vad3JPxCztBRY591N8=";
};

cargoHash = "sha256-kuZ1zvb6H5QWjJSUYMq5tEywsQMC6187YJPUT1r4S5o=";
cargoPatches = [
# <https://github.com/jj-vcs/jj/pull/5315>
./libgit2-1.9.0.patch
];

cargoHash = "sha256-QEd5UIC7sgsTllKQx0RWopGcIBuZf30PxBBi0r7OlAU=";

nativeBuildInputs = [
installShellFiles
Expand Down
153 changes: 153 additions & 0 deletions pkgs/by-name/li/libgit2-glib/libgit2-1.9.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
From 46bad01581bca5bc64f6499eb1222ff067721a63 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <[email protected]>
Date: Fri, 5 Apr 2024 10:28:16 +0200
Subject: [PATCH 1/2] build: Fix build against, and require, libgit2 1.8.0

---
libgit2-glib/ggit-clone-options.c | 1 +
libgit2-glib/ggit-cred-ssh-interactive.c | 2 +-
libgit2-glib/ggit-remote-callbacks.h | 1 +
libgit2-glib/ggit-repository.c | 4 ++--
libgit2-glib/ggit-types.h | 3 ++-
meson.build | 2 +-
6 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/libgit2-glib/ggit-clone-options.c b/libgit2-glib/ggit-clone-options.c
index b47fdb1..30c7d86 100644
--- a/libgit2-glib/ggit-clone-options.c
+++ b/libgit2-glib/ggit-clone-options.c
@@ -19,6 +19,7 @@
*/

#include <git2.h>
+#include <git2/sys/errors.h>
#include <gio/gio.h>

#include "ggit-clone-options.h"
diff --git a/libgit2-glib/ggit-cred-ssh-interactive.c b/libgit2-glib/ggit-cred-ssh-interactive.c
index 4f60f8b..0bdca95 100644
--- a/libgit2-glib/ggit-cred-ssh-interactive.c
+++ b/libgit2-glib/ggit-cred-ssh-interactive.c
@@ -191,7 +191,7 @@ callback_wrapper (const char *name,
{
gchar *text;

- text = g_strndup (prompts[i].text, prompts[i].length);
+ text = g_strndup ((const gchar *)prompts[i].text, prompts[i].length);

wprompts[i] = ggit_cred_ssh_interactive_prompt_new (wname,
winstruction,
diff --git a/libgit2-glib/ggit-remote-callbacks.h b/libgit2-glib/ggit-remote-callbacks.h
index 3005ff4..2340712 100644
--- a/libgit2-glib/ggit-remote-callbacks.h
+++ b/libgit2-glib/ggit-remote-callbacks.h
@@ -24,6 +24,7 @@

#include <glib-object.h>
#include <git2.h>
+#include <git2/sys/errors.h>
#include <libgit2-glib/ggit-cred.h>

G_BEGIN_DECLS
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index bf099f6..936c6fc 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -3182,7 +3182,7 @@ ggit_repository_create_commit (GgitRepository *repository,
message,
_ggit_native_get (tree),
parent_count,
- (const git_commit **)parents_native);
+ (gpointer)parents_native);

g_free (parents_native);

@@ -3323,7 +3323,7 @@ ggit_repository_create_commit_buffer(GgitRepository *repository,
message,
_ggit_tree_get_tree (tree),
parent_count,
- (git_commit const **)parents_native);
+ (gpointer)parents_native);

g_free (parents_native);

diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 7e28975..2a2ed99 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -355,7 +355,8 @@ typedef enum
GGIT_CONFIG_LEVEL_XDG = 3,
GGIT_CONFIG_LEVEL_GLOBAL = 4,
GGIT_CONFIG_LEVEL_LOCAL = 5,
- GGIT_CONFIG_LEVEL_APP = 6,
+ GGIT_CONFIG_LEVEL_WORKTREE = 6,
+ GGIT_CONFIG_LEVEL_APP = 7,
GGIT_CONFIG_LEVEL_HIGHEST = -1
} GgitConfigLevel;

diff --git a/meson.build b/meson.build
index e54a8b4..c21107d 100644
--- a/meson.build
+++ b/meson.build
@@ -126,7 +126,7 @@ glib_dep = dependency('glib-2.0', version: '>=' + glib_req)
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_req)
gio_dep = dependency('gio-2.0', version: '>=' + glib_req)

-libgit2_dep = dependency('libgit2', version: '>= 0.25.0')
+libgit2_dep = dependency('libgit2', version: '>= 1.8.0')

# XXX: Not nice, but probably our best option
enable_gir = get_option('introspection') and find_program('g-ir-scanner', required: false).found()
--
GitLab


From 93685d4297e425af67ac6888d6b66dfbcd4b95c8 Mon Sep 17 00:00:00 2001
From: Rui Chen <[email protected]>
Date: Mon, 13 Jan 2025 21:23:50 -0500
Subject: [PATCH 2/2] chore: support libgit2 1.9

Signed-off-by: Rui Chen <[email protected]>
---
libgit2-glib/ggit-types.h | 4 ++--
meson.build | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 2a2ed99..184c3e6 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -990,8 +990,7 @@ typedef enum

typedef enum
{
- GGIT_CHECKOUT_NONE = 0,
- GGIT_CHECKOUT_SAFE = (1u << 0),
+ GGIT_CHECKOUT_SAFE = 0,
GGIT_CHECKOUT_FORCE = (1u << 1),
GGIT_CHECKOUT_RECREATE_MISSING = (1u << 2),
GGIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4),
@@ -1010,6 +1009,7 @@ typedef enum
GGIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = (1u << 21),
GGIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22),
GGIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23),
+ GGIT_CHECKOUT_NONE = (1u << 30),
GGIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16),
GGIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17)
} GgitCheckoutStrategy;
diff --git a/meson.build b/meson.build
index c21107d..9cd26f8 100644
--- a/meson.build
+++ b/meson.build
@@ -126,7 +126,7 @@ glib_dep = dependency('glib-2.0', version: '>=' + glib_req)
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_req)
gio_dep = dependency('gio-2.0', version: '>=' + glib_req)

-libgit2_dep = dependency('libgit2', version: '>= 1.8.0')
+libgit2_dep = dependency('libgit2', version: '>= 1.9.0')

# XXX: Not nice, but probably our best option
enable_gir = get_option('introspection') and find_program('g-ir-scanner', required: false).found()
--
GitLab

10 changes: 4 additions & 6 deletions pkgs/by-name/li/libgit2-glib/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ stdenv.mkDerivation rec {
};

patches = [
(fetchpatch {
name = "support-libgit2-1.8.patch";
# https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/40
url = "https://gitlab.gnome.org/GNOME/libgit2-glib/-/commit/a76fdf96c3af9ce9d21a3985c4be8a1aa6eea661.patch";
hash = "sha256-ysU8pAixyftensfEC9bE0RUFMPMei0jYT26WKN5uOFE=";
})
# See:
# * <https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/40>
# * <https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/46>
./libgit2-1.9.0.patch
];

nativeBuildInputs = [
Expand Down
18 changes: 15 additions & 3 deletions pkgs/development/libraries/libgit2/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, pkg-config
, python3
Expand All @@ -22,7 +23,7 @@

stdenv.mkDerivation (finalAttrs: {
pname = "libgit2";
version = "1.8.4";
version = "1.9.0";
# also check the following packages for updates: python3Packages.pygit2 and libgit2-glib

outputs = ["lib" "dev" "out"];
Expand All @@ -31,19 +32,30 @@ stdenv.mkDerivation (finalAttrs: {
owner = "libgit2";
repo = "libgit2";
rev = "v${finalAttrs.version}";
hash = "sha256-AVhDq9nC2ccwFYJmejr0hmnyV4AxZLamuHktYPlkzUs=";
hash = "sha256-v32yGMo5oFEl6HUdg8czCsCLDL+sy9PPT0AEWmKxUhk=";
};

patches = [
(fetchpatch {
name = "libgit2-darwin-case-sensitive-build.patch";
url = "https://github.com/libgit2/libgit2/commit/1b348a31349e847b1d8548281aa92f26b9783f2f.patch";
hash = "sha256-CBaUuEr3nPdUuOdyJtmPgyqR0MNnVyOFYbYXF3ncupU=";
})
];

cmakeFlags = [
"-DREGEX_BACKEND=pcre2"
"-DUSE_HTTP_PARSER=system"
"-DUSE_HTTP_PARSER=llhttp"
"-DUSE_SSH=ON"
(lib.cmakeBool "USE_GSSAPI" withGssapi)
"-DBUILD_SHARED_LIBS=${if staticBuild then "OFF" else "ON"}"
] ++ lib.optionals stdenv.hostPlatform.isWindows [
"-DDLLTOOL=${stdenv.cc.bintools.targetPrefix}dlltool"
# For ws2_32, refered to by a `*.pc` file
"-DCMAKE_LIBRARY_PATH=${stdenv.cc.libc}/lib"
] ++ lib.optionals stdenv.hostPlatform.isOpenBSD [
# openbsd headers fail with default c90
"-DCMAKE_C_STANDARD=99"
];

nativeBuildInputs = [ cmake python3 pkg-config ];
Expand Down
Loading