MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / is_ignored_by_git

Function is_ignored_by_git

src/config.rs:511–543  ·  view source on GitHub ↗
(project_path: &Path, git_config_global: Option<&Path>)

Source from the content-addressed store, hash-verified

509}
510
511fn is_ignored_by_git(project_path: &Path, git_config_global: Option<&Path>) -> Option<bool> {
512 let fallback_global_excludes = || {
513 git_config_global
514 .and_then(|path| is_ignored_by_explicit_global_excludes(project_path, path))
515 };
516 let dir_name = active_data_dir_name(project_path);
517 let mut command = Command::new(crate::git::git_program());
518 command
519 .arg("-C")
520 .arg(project_path)
521 .arg("check-ignore")
522 .arg("-q")
523 .arg(format!("{dir_name}/"))
524 .stdout(Stdio::null())
525 .stderr(Stdio::null());
526
527 if let Some(path) = git_config_global {
528 command.env_clear();
529 command.env("PATH", git_subprocess_path());
530 command.env("GIT_CONFIG_GLOBAL", path);
531 command.env("GIT_CONFIG_NOSYSTEM", "1");
532 }
533
534 let Ok(status) = command.status() else {
535 return fallback_global_excludes();
536 };
537
538 match status.code() {
539 Some(0) => Some(true),
540 Some(1) => Some(false),
541 _ => fallback_global_excludes(),
542 }
543}
544
545fn is_ignored_by_explicit_global_excludes(
546 project_path: &Path,

Calls 6

active_data_dir_nameFunction · 0.85
git_subprocess_pathFunction · 0.85
statusMethod · 0.80
codeMethod · 0.80
git_programFunction · 0.70