Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
storage: Rewrite temporary repositories for clones
Merged lorenz opened 8 months ago

On Windows, all attempts to clone repositories failed with

Fetch failed for rad:… from z6Mk…: Access is denied. (os error 5)

The reason is that, other than Unix-like systems, it forbids that directories that are in use are moved.

To improve the situation, take back control over what is moved and removed exactly by implementing cleanup instead of relying on impl Drop for tempfile::TempDir.

fn lock_repository is renamed to fn temporary_repository because it does not do any locking. Also, the directory name now contains “tmp” instead of “lock”.

In the future (once Rust 1.89 is a little less cutting edge and more widely available), we may opt for actual locking via std::fs::File::lock.

lorenz opened with revision dddddff2 on base 19a262d3 +84 -17 8 months ago

On Windows, all attempts to clone repositories failed with

Fetch failed for rad:… from z6Mk…: Access is denied. (os error 5)

The reason is that, other than Unix-like systems, it forbids that directories that are in use are moved.

To improve the situation, take back control over what is moved and removed exactly by implementing cleanup instead of relying on impl Drop for tempfile::TempDir.

fn lock_repository is renamed to fn temporary_repository because it does not do any locking. Also, the directory name now contains “tmp” instead of “lock”.

In the future (once Rust 1.89 is a little less cutting edge and more widely available), we may opt for actual locking via std::fs::File::lock.

lorenz pushed revision 2 1f6bec06 on base 19a262d3 +75 -16 8 months ago

Fix mutability and simplify

lorenz pushed revision 3 317f20c1 on base 19a262d3 +63 -18 8 months ago

An alternative solution.

lorenz pushed revision 4 5d732d50 on base ee49e287 +65 -18 7 months ago

Rebase

lorenz pushed revision 5 77e4254a on base 5cd016b5 +58 -31 6 months ago

Remove the concept of a temporary path.

fintohaps pushed revision 6 1db0d8c5 on base 5cd016b5 +227 -120 6 months ago

Introduce TempRepository type

To get this to work, some preparation work was required in radicle-fetch.

The first commit cleans up the use of accessing the repo directly, and uses the Handle::repository method instead.

The second commit then refactors so that a generic AsRef<Repository> can be used instead.

The third commit introduces a method for getting back the underlying repository.

And finally, the original commit was refactored to use a TempRepository type for handling the clean up and move logic – so that the implementation does not leak into radicle-node.

lorenz pushed revision 7 f9fe96e1 on base 5caa7b30 +227 -120 6 months ago

Rebase.

lorenz merged revision f9fe96e1 at 2149770a 6 months ago