Unverified Commit ea38b23a authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

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

parents a66fb56f 65fa6b9c
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
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!(
+14 −0
Original line number Diff line number Diff line
@@ -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 ];