From 252453c81b105706db1fe1ea43d39f426ef63c9c Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 9 Mar 2026 14:01:05 -0400 Subject: [PATCH] Remove dead is_tracked function from git module No longer used after resolve_file_ref stopped checking git tracking. Co-Authored-By: Claude Opus 4.6 --- lib/crates/arc-workflows/src/git.rs | 56 ----------------------------- 1 file changed, 56 deletions(-) diff --git a/lib/crates/arc-workflows/src/git.rs b/lib/crates/arc-workflows/src/git.rs index 8ca101d19..2b3782253 100644 --- a/lib/crates/arc-workflows/src/git.rs +++ b/lib/crates/arc-workflows/src/git.rs @@ -302,18 +302,6 @@ pub fn push_ref(repo: &Path, url: &str, refname: &str) -> Result<()> { Ok(()) } -/// Check whether a file is tracked by git in the given repo. -/// Returns `false` if the file is untracked or git is unavailable. -pub fn is_tracked(repo: &Path, file: &Path) -> bool { - git_cmd(repo) - .args(["ls-files", "--error-unmatch"]) - .arg(file) - .stdout(std::process::Stdio::null()) - .stderr(std::process::Stdio::null()) - .status() - .is_ok_and(|s| s.success()) -} - /// Sanitize a string for use as a git ref component. /// Lowercases, replaces non-alphanumeric chars with dashes, collapses runs. pub fn sanitize_ref_component(s: &str) -> String { @@ -1206,48 +1194,4 @@ mod tests { "remote should have test-push branch" ); } - - #[test] - fn is_tracked_returns_true_for_committed_file() { - let dir = tempfile::tempdir().unwrap(); - init_repo(dir.path()); - let file = dir.path().join("tracked.txt"); - fs::write(&file, "hello").unwrap(); - Command::new("git") - .args(["add", "tracked.txt"]) - .current_dir(dir.path()) - .output() - .unwrap(); - Command::new("git") - .args([ - "-c", - "user.name=test", - "-c", - "user.email=test@test", - "commit", - "-m", - "add file", - ]) - .current_dir(dir.path()) - .output() - .unwrap(); - assert!(is_tracked(dir.path(), &file)); - } - - #[test] - fn is_tracked_returns_false_for_untracked_file() { - let dir = tempfile::tempdir().unwrap(); - init_repo(dir.path()); - let file = dir.path().join("untracked.txt"); - fs::write(&file, "hello").unwrap(); - assert!(!is_tracked(dir.path(), &file)); - } - - #[test] - fn is_tracked_returns_false_for_non_repo_dir() { - let dir = tempfile::tempdir().unwrap(); - let file = dir.path().join("some.txt"); - fs::write(&file, "hello").unwrap(); - assert!(!is_tracked(dir.path(), &file)); - } }