git-branchless: fix build (broken by rust 1.89) (#437517)

This commit is contained in:
Sandro
2025-08-31 16:31:15 +02:00
committed by GitHub
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
diff --git a/src/lock.rs b/src/lock.rs
--- a/src/lock.rs
+++ b/src/lock.rs
@@ -132,10 +132,10 @@ impl ScopedDirLock {
// Lock
match (opts.exclusive, opts.non_blocking) {
- (true, false) => file.lock_exclusive(),
- (true, true) => file.try_lock_exclusive(),
- (false, false) => file.lock_shared(),
- (false, true) => file.try_lock_shared(),
+ (true, false) => fs2::FileExt::lock_exclusive(&file),
+ (true, true) => fs2::FileExt::try_lock_exclusive(&file),
+ (false, false) => fs2::FileExt::lock_shared(&file),
+ (false, true) => fs2::FileExt::try_lock_shared(&file),
}
.context(&path, || {
format!(

View File

@@ -21,6 +21,20 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-8uv+sZRr06K42hmxgjrKk6FDEngUhN/9epixRYKwE3U=";
};
# Patch the vendored esl01-indexedlog crate.
# This is necessary to fix the build for rust 1.89. See:
# - https://github.com/NixOS/nixpkgs/issues/437051
# - https://github.com/arxanas/git-branchless/issues/1585
# - https://github.com/facebook/sapling/issues/1119
# The patch is derived from:
# - https://github.com/facebook/sapling/commit/9e27acb84605079bf4e305afb637a4d6801831ac
postPatch = ''
(
cd ../git-branchless-*-vendor/esl01-indexedlog-*/
patch -p1 < ${./fix-esl01-indexedlog-for-rust-1_89.patch}
)
'';
cargoHash = "sha256-i7KpTd4fX3PrhDjj3R9u98rdI0uHkpQCxSmEF+Gu7yk=";
nativeBuildInputs = [ pkg-config ];