clockworklabs/SpacetimeDB · error

Failed to execute git ls-files

Error message

Failed to execute git ls-files

What it means

Error "Failed to execute git ls-files" thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/cli/build.rs:411

        })
}

fn get_git_tracked_files_via_cli(path: &Path, manifest_dir: &Path) -> (Vec<PathBuf>, PathBuf) {
    let repo_root = get_repo_root();
    let repo_root = repo_root.canonicalize().unwrap_or_else(|err| {
        panic!(
            "Failed to canonicalize repo_root path {}: {err:#?}",
            repo_root.display(),
        )
    });

    let resolved_path = make_repo_root_relative(&get_full_path_within_manifest_dir(path, manifest_dir), &repo_root);

    let output = Command::new("git")
        .args(["ls-files", resolved_path.to_str().unwrap()])
        .current_dir(repo_root)
        .output()
        .expect("Failed to execute git ls-files");

    if !output.status.success() {
        return (Vec::new(), resolved_path);
    }

    let stdout = String::from_utf8(output.stdout).unwrap();
    let files: Vec<PathBuf> = stdout
        .lines()
        .filter(|line| !line.is_empty())
        .map(PathBuf::from)
        .collect();

    (files, resolved_path)
}

fn get_repo_root() -> PathBuf {
    let manifest_dir = get_manifest_dir();
    // Cargo doesn't expose a way to get the workspace root, AFAICT (pgoldman 2025-10-31).

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/cli/build.rs:411 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/0879598e46c38a28. Report an issue: GitHub.