This commit is contained in:
Ani Betts 2024-05-15 17:13:44 +02:00
parent ddc2cfeb67
commit 2ff2b1f7ec
No known key found for this signature in database
5 changed files with 12 additions and 17 deletions

View File

@ -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.

View File

@ -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)
}));
}

View File

@ -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,

View File

@ -222,15 +222,13 @@ impl<T: FileIdCache> DebounceDataInner<T> {
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;
}
}

View File

@ -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<InternalEvent>,
) -> Result<Arc<Debouncer<RecommendedWatcher, FileIdMap>>> {
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),