Skip to content

Commit f755f3c

Browse files
committed
git-branchless: update to use libgit2 1.9
Signed-off-by: Rui Chen <[email protected]>
1 parent 066b661 commit f755f3c

File tree

1 file changed

+75
-5
lines changed

1 file changed

+75
-5
lines changed

Formula/g/git-branchless.rb

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
class GitBranchless < Formula
22
desc "High-velocity, monorepo-scale workflow for Git"
33
homepage "https://github.com/arxanas/git-branchless"
4-
url "https://github.com/arxanas/git-branchless/archive/refs/tags/v0.10.0.tar.gz"
5-
sha256 "1eb8dbb85839c5b0d333e8c3f9011c3f725e0244bb92f4db918fce9d69851ff7"
64
license any_of: ["Apache-2.0", "MIT"]
7-
revision 1
5+
revision 2
86
head "https://github.com/arxanas/git-branchless.git", branch: "master"
97

8+
stable do
9+
url "https://github.com/arxanas/git-branchless/archive/refs/tags/v0.10.0.tar.gz"
10+
sha256 "1eb8dbb85839c5b0d333e8c3f9011c3f725e0244bb92f4db918fce9d69851ff7"
11+
12+
# patch to use libgit2 1.9, upstream pr ref, https://github.com/arxanas/git-branchless/pull/1485
13+
patch :DATA
14+
end
15+
1016
# Upstream appears to use GitHub releases to indicate that a version is
1117
# released (and some tagged versions don't end up as a release), so it's
1218
# necessary to check release versions instead of tags.
@@ -26,7 +32,7 @@ class GitBranchless < Formula
2632

2733
depends_on "pkgconf" => :build
2834
depends_on "rust" => :build
29-
depends_on "libgit2@1.8" # needs https://github.com/rust-lang/git2-rs/issues/1109 to support libgit2 1.9
35+
depends_on "libgit2"
3036

3137
def install
3238
ENV["LIBGIT2_NO_VENDOR"] = "1"
@@ -50,9 +56,73 @@ def install
5056
linkage_with_libgit2 = (bin/"git-branchless").dynamically_linked_libraries.any? do |dll|
5157
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)
5258

53-
File.realpath(dll) == (Formula["libgit2@1.8"].opt_lib/shared_library("libgit2")).realpath.to_s
59+
File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
5460
end
5561

5662
assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
5763
end
5864
end
65+
66+
__END__
67+
diff --git a/Cargo.lock b/Cargo.lock
68+
index ecd3295..19168b5 100644
69+
--- a/Cargo.lock
70+
+++ b/Cargo.lock
71+
@@ -1756,9 +1756,9 @@ dependencies = [
72+
73+
[[package]]
74+
name = "git2"
75+
-version = "0.19.0"
76+
+version = "0.20.0"
77+
source = "registry+https://github.com/rust-lang/crates.io-index"
78+
-checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
79+
+checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff"
80+
dependencies = [
81+
"bitflags 2.5.0",
82+
"libc",
83+
@@ -2063,9 +2063,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
84+
85+
[[package]]
86+
name = "libgit2-sys"
87+
-version = "0.17.0+1.8.1"
88+
+version = "0.18.0+1.9.0"
89+
source = "registry+https://github.com/rust-lang/crates.io-index"
90+
-checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
91+
+checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec"
92+
dependencies = [
93+
"cc",
94+
"libc",
95+
diff --git a/Cargo.toml b/Cargo.toml
96+
index 1c806fa..fa0364a 100644
97+
--- a/Cargo.toml
98+
+++ b/Cargo.toml
99+
@@ -69,7 +69,7 @@ git-branchless-smartlog = { version = "0.10.0", path = "git-branchless-smartlog"
100+
git-branchless-submit = { version = "0.10.0", path = "git-branchless-submit" }
101+
git-branchless-test = { version = "0.10.0", path = "git-branchless-test" }
102+
git-branchless-undo = { version = "0.10.0", path = "git-branchless-undo" }
103+
-git2 = { version = "0.19.0", default-features = false }
104+
+git2 = { version = "0.20.0", default-features = false }
105+
glob = "0.3.0"
106+
indexmap = "2.2.6"
107+
indicatif = { version = "0.17.8", features = ["improved_unicode"] }
108+
diff --git a/git-branchless-invoke/src/lib.rs b/git-branchless-invoke/src/lib.rs
109+
index eee43ff..a6cd973 100644
110+
--- a/git-branchless-invoke/src/lib.rs
111+
+++ b/git-branchless-invoke/src/lib.rs
112+
@@ -117,12 +117,12 @@ fn install_tracing(effects: Effects) -> eyre::Result<impl Drop> {
113+
114+
#[instrument]
115+
fn install_libgit2_tracing() {
116+
- fn git_trace(level: git2::TraceLevel, msg: &str) {
117+
- info!("[{:?}]: {}", level, msg);
118+
+ fn git_trace(level: git2::TraceLevel, msg: &[u8]) {
119+
+ info!("[{:?}]: {}", level, String::from_utf8_lossy(msg));
120+
}
121+
122+
- if !git2::trace_set(git2::TraceLevel::Trace, git_trace) {
123+
- warn!("Failed to install libgit2 tracing");
124+
+ if let Err(err) = git2::trace_set(git2::TraceLevel::Trace, git_trace) {
125+
+ warn!("Failed to install libgit2 tracing: {err}");
126+
}
127+
}
128+

0 commit comments

Comments
 (0)