fix: force Git checkout for plugin cache repositories (#3169)

This commit is contained in:
三咲雅 misaki masa 2025-09-14 19:42:30 +08:00 committed by GitHub
parent 4a3710b1c4
commit a3fc9a0ec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 196 additions and 5 deletions

View file

@ -16,7 +16,7 @@ impl Git {
}
pub(super) async fn checkout(path: &Path, rev: &str) -> Result<()> {
Self::exec(|c| c.args(["checkout", rev]).current_dir(path)).await
Self::exec(|c| c.args(["checkout", rev, "--force"]).current_dir(path)).await
}
pub(super) async fn pull(path: &Path) -> Result<()> {

View file

@ -1,6 +1,6 @@
#![allow(clippy::module_inception)]
yazi_macro::mod_pub!(keymap mgr open opener plugin popup preview scheme tasks theme which);
yazi_macro::mod_pub!(keymap mgr open opener plugin popup preview tasks theme vfs which);
yazi_macro::mod_flat!(color icon layout pattern platform preset priority style yazi);

View file

@ -1,3 +1,3 @@
yazi_macro::mod_pub!(local);
yazi_macro::mod_pub!(local sftp);
yazi_macro::mod_flat!(buffer dir_entry provider read_dir rw_file);

View file

@ -0,0 +1 @@
yazi_macro::mod_flat!(sftp);

View file

@ -0,0 +1,190 @@
use std::{io, path::{Path, PathBuf}};
use crate::cha::Cha;
pub struct Sftp;
impl Sftp {
pub fn cache<P>(_: P) -> Option<PathBuf>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn canonicalize<P>(path: P) -> io::Result<PathBuf>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn copy<P, Q>(from: P, to: Q, cha: Cha) -> io::Result<u64>
where
P: AsRef<Path>,
Q: AsRef<Path>,
{
todo!()
}
pub async fn create<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn create_dir<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn create_dir_all<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn hard_link<P, Q>(original: P, link: Q) -> io::Result<()>
where
P: AsRef<Path>,
Q: AsRef<Path>,
{
todo!()
}
pub async fn metadata<P>(path: P) -> io::Result<std::fs::Metadata>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn open<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn read<P>(path: P) -> io::Result<Vec<u8>>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn read_dir<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub fn read_dir_sync<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn read_link<P>(path: P) -> io::Result<PathBuf>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn read_to_string<P>(path: P) -> io::Result<String>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn remove_dir<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn remove_dir_all<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn remove_file<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn rename<P, Q>(from: P, to: Q) -> io::Result<()>
where
P: AsRef<Path>,
Q: AsRef<Path>,
{
todo!()
}
pub async fn symlink<P, Q, F>(original: P, link: Q, _is_dir: F) -> io::Result<()>
where
P: AsRef<Path>,
Q: AsRef<Path>,
F: AsyncFnOnce() -> io::Result<bool>,
{
todo!()
}
pub async fn symlink_dir<P, Q>(original: P, link: Q) -> io::Result<()>
where
P: AsRef<Path>,
Q: AsRef<Path>,
{
todo!()
}
pub async fn symlink_file<P, Q>(original: P, link: Q) -> io::Result<()>
where
P: AsRef<Path>,
Q: AsRef<Path>,
{
todo!()
}
pub async fn symlink_metadata<P>(path: P) -> io::Result<std::fs::Metadata>
where
P: AsRef<Path>,
{
todo!()
}
pub fn symlink_metadata_sync<P>(path: P) -> io::Result<std::fs::Metadata>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn trash<P>(path: P) -> io::Result<()>
where
P: AsRef<Path>,
{
todo!()
}
pub async fn write<P, C>(path: P, contents: C) -> io::Result<()>
where
P: AsRef<Path>,
C: AsRef<[u8]>,
{
todo!()
}
}

View file

@ -1,4 +1,4 @@
## yazi-sftp
# yazi-sftp
A fork of [`russh-sftp`](https://github.com/AspectUnk/russh-sftp) used by Yazi, with some changes:
@ -6,7 +6,7 @@ A fork of [`russh-sftp`](https://github.com/AspectUnk/russh-sftp) used by Yazi,
- Supports retrieving file nlink, username, and group
- Uses generic return parameters for a more idiomatic API, e.g.:
```rust
let attrs: responses::Attrs = session.send(requests::Stat::new(path)).await?;
let attrs: responses::Attrs = session.send(requests::Stat::new(path)).await?
```
- Reduced dependencies
- Performance optimizations: