Skip to content

Commit 387dc92

Browse files
committed
git-branchless: backport support for libgit2 1.7
Signed-off-by: Michael Cho <michael@michaelcho.dev>
1 parent 03b2d3a commit 387dc92

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

Formula/g/git-branchless.rb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
class GitBranchless < Formula
22
desc "High-velocity, monorepo-scale workflow for Git"
33
homepage "https://github.com/arxanas/git-branchless"
4-
# TODO: check if we can use unversioned `libgit2` at version bump.
5-
# See comments below for details.
6-
url "https://github.com/arxanas/git-branchless/archive/refs/tags/v0.8.0.tar.gz"
7-
sha256 "f9e13d9a3de960b32fb684a59492defd812bb0785df48facc964478f675f0355"
84
license any_of: ["Apache-2.0", "MIT"]
95
revision 1
106
head "https://github.com/arxanas/git-branchless.git", branch: "master"
117

8+
stable do
9+
url "https://github.com/arxanas/git-branchless/archive/refs/tags/v0.8.0.tar.gz"
10+
sha256 "f9e13d9a3de960b32fb684a59492defd812bb0785df48facc964478f675f0355"
11+
12+
# Backport support for libgit2 1.7
13+
patch do
14+
url "https://github.com/arxanas/git-branchless/commit/5b3d67b20e7fb910be46ea3ee9d0642d11932681.patch?full_index=1"
15+
sha256 "ff81ca9c921fc6b8254a75fecec3fc606f168215f66eb658803097b6bb2fcdb8"
16+
end
17+
end
18+
1219
# Upstream appears to use GitHub releases to indicate that a version is
1320
# released (and some tagged versions don't end up as a release), so it's
1421
# necessary to check release versions instead of tags.
@@ -29,15 +36,10 @@ class GitBranchless < Formula
2936

3037
depends_on "pkg-config" => :build
3138
depends_on "rust" => :build
32-
# To check for `libgit2` version:
33-
# 1. Search for `libgit2-sys` version at https://github.com/arxanas/git-branchless/blob/v#{version}/Cargo.lock
34-
# 2. If the version suffix of `libgit2-sys` is newer than +1.6.*, then:
35-
# - Migrate to the corresponding `libgit2` formula.
36-
# - Change the `LIBGIT2_SYS_USE_PKG_CONFIG` env var below to `LIBGIT2_NO_VENDOR`.
37-
# See: https://github.com/rust-lang/git2-rs/commit/59a81cac9ada22b5ea6ca2841f5bd1229f1dd659.
38-
depends_on "libgit2@1.6"
39+
depends_on "libgit2"
3940

4041
def install
42+
ENV["LIBGIT2_NO_VENDOR"] = "1"
4143
# make sure git can find git-branchless
4244
ENV.prepend_path "PATH", bin
4345

@@ -58,7 +60,7 @@ def install
5860
linkage_with_libgit2 = (bin/"git-branchless").dynamically_linked_libraries.any? do |dll|
5961
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)
6062

61-
File.realpath(dll) == (Formula["libgit2@1.6"].opt_lib/shared_library("libgit2")).realpath.to_s
63+
File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
6264
end
6365

6466
assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."

0 commit comments

Comments
 (0)