diff --git a/crates/gitbutler-core/src/fs.rs b/crates/gitbutler-core/src/fs.rs index 89c82b865..017f43bf1 100644 --- a/crates/gitbutler-core/src/fs.rs +++ b/crates/gitbutler-core/src/fs.rs @@ -1,11 +1,8 @@ -use std::io::Write; use std::path::{Path, PathBuf}; use anyhow::Result; use bstr::BString; use gix::dir::walk::EmissionMode; -use gix::tempfile::create_dir::Retries; -use gix::tempfile::{AutoRemove, ContainingDirectory}; use walkdir::WalkDir; // Returns an ordered list of relative paths for files inside a directory recursively. diff --git a/crates/gitbutler-git/src/executor/tokio/mod.rs b/crates/gitbutler-git/src/executor/tokio/mod.rs index 52cdb11ce..980034f1b 100644 --- a/crates/gitbutler-git/src/executor/tokio/mod.rs +++ b/crates/gitbutler-git/src/executor/tokio/mod.rs @@ -91,7 +91,7 @@ unsafe impl super::GitExecutor for TokioExecutor { #[cfg(windows)] { cmd.envs(envs.iter().map(|(k, v)| { - let v = v.replace("\\", "\\\\"); + let v = v.replace('\\', "\\\\"); (k, v) })); } diff --git a/crates/gitbutler-tauri/src/main.rs b/crates/gitbutler-tauri/src/main.rs index ed9844411..1a3bfca75 100644 --- a/crates/gitbutler-tauri/src/main.rs +++ b/crates/gitbutler-tauri/src/main.rs @@ -13,9 +13,8 @@ clippy::too_many_lines )] -use std::{future::IntoFuture, path::PathBuf}; +use std::path::PathBuf; -use futures::FutureExt; use gitbutler_core::{assets, git, storage}; use gitbutler_tauri::{ app, askpass, commands, github, keys, logs, menu, projects, undo, users, virtual_branches, diff --git a/crates/gitbutler-watcher/src/debouncer.rs b/crates/gitbutler-watcher/src/debouncer.rs index be525b69c..6ce6cf23c 100644 --- a/crates/gitbutler-watcher/src/debouncer.rs +++ b/crates/gitbutler-watcher/src/debouncer.rs @@ -222,15 +222,13 @@ impl DebounceDataInner { kind_index.insert(event.kind, events_expired.len()); + events_expired.push(event); + } else if flush_all { + tracing::debug!("Flushing event! {:?}", event.event); events_expired.push(event); } else { - if flush_all { - tracing::debug!("Flushing event! {:?}", event.event); - events_expired.push(event); - } else { - queue.events.push_front(event); - break; - } + queue.events.push_front(event); + break; } } diff --git a/crates/gitbutler-watcher/src/file_monitor.rs b/crates/gitbutler-watcher/src/file_monitor.rs index 4cb839171..0abd3c9a5 100644 --- a/crates/gitbutler-watcher/src/file_monitor.rs +++ b/crates/gitbutler-watcher/src/file_monitor.rs @@ -1,6 +1,6 @@ -use std::{collections::HashSet, sync::Arc}; use std::path::Path; use std::time::Duration; +use std::{collections::HashSet, sync::Arc}; use crate::debouncer::Debouncer; use crate::debouncer_cache::FileIdMap; @@ -11,7 +11,7 @@ use notify::{RecommendedWatcher, Watcher}; use tokio::task; use tracing::Level; -/// We will collect notifications for up to this amount of time at a very +/// We will collect notifications for up to this amount of time at a very /// maximum before releasing them. This duration will be hit if e.g. a build /// is constantly running and producing a lot of file changes, we will process /// them even if the build is still running. @@ -20,7 +20,7 @@ const DEBOUNCE_TIMEOUT: Duration = Duration::from_secs(60); // The internal rate at which the debouncer will update its state. const TICK_RATE: Duration = Duration::from_millis(250); -// The number of TICK_RATE intervals required of "dead air" (i.e. no new events +// The number of TICK_RATE intervals required of "dead air" (i.e. no new events // arriving) before we will automatically flush pending events. This means that // after the disk is quiet for TICK_RATE * FLUSH_AFTER_EMPTY, we will process // the pending events, even if DEBOUNCE_TIMEOUT hasn't expired yet @@ -56,7 +56,8 @@ pub fn spawn( out: tokio::sync::mpsc::UnboundedSender, ) -> Result>> { let (notify_tx, notify_rx) = std::sync::mpsc::channel(); - let mut debouncer = Arc::new(new_debouncer( + let mut debouncer = Arc::new( + new_debouncer( DEBOUNCE_TIMEOUT, Some(TICK_RATE), Some(FLUSH_AFTER_EMPTY),