fix: keep native HoloLake entry responsive
This commit is contained in:
parent
3ff80d583a
commit
7a985a3761
9 changed files with 143 additions and 36 deletions
|
|
@ -129,9 +129,9 @@ fn git_head_hash(vault: &Path) -> Option<String> {
|
|||
|
||||
/// Run a git command in the given directory and return stdout if successful.
|
||||
fn run_git(vault: &Path, args: &[&str]) -> Option<String> {
|
||||
let output = crate::git::git_command_at(vault)
|
||||
.and_then(|mut command| command.args(args).output())
|
||||
.ok()?;
|
||||
let mut command = crate::git::git_command_at(vault).ok()?;
|
||||
command.args(args);
|
||||
let output = crate::git::command_output_with_timeout(&mut command, Duration::from_secs(2))?;
|
||||
if !output.status.success() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::collections::HashSet;
|
|||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
use tempfile::NamedTempFile;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
|
|
@ -599,9 +600,14 @@ pub struct DetectedRename {
|
|||
pub fn detect_renames(vault: &Path) -> Result<Vec<DetectedRename>, String> {
|
||||
let output = crate::git::git_command_at(vault)
|
||||
.and_then(|mut command| {
|
||||
command
|
||||
.args(["diff", "HEAD", "--name-status", "--diff-filter=R", "-M"])
|
||||
.output()
|
||||
command.args(["diff", "HEAD", "--name-status", "--diff-filter=R", "-M"]);
|
||||
crate::git::command_output_with_timeout(&mut command, Duration::from_secs(2))
|
||||
.ok_or_else(|| {
|
||||
std::io::Error::new(
|
||||
std::io::ErrorKind::TimedOut,
|
||||
"git rename detection exceeded its deadline",
|
||||
)
|
||||
})
|
||||
})
|
||||
.map_err(|e| format!("Failed to run git diff: {e}"))?;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue