jdx/mise · error

listing snapshot files requires git

Error message

listing snapshot files requires git

What it means

When `history show --files` finds a content snapshot tree reference, it still needs the git repository to run ls-tree. If store.repo() is None (no git backing), listing is impossible and run() bails with this message.

Solutions

  1. Install/restore git so it is on PATH
  2. Restore the store's .git directory or reinitialize the history store
  3. Use the journal output without --files as a fallback

Example fix

// before: git missing
mise dotfiles history show ckpt123 --files   // bails
// after
export PATH="$PATH:/usr/bin"  # or install git
mise dotfiles history show ckpt123 --files
Defensive patterns

Strategy: fallback

Validate before calling

command -v git >/dev/null 2>&1 || echo 'git required to list snapshot files'

Try / catch

if let Err(e) = show_files() { if e.to_string().contains("requires git") { eprintln!("install git, or use journal output"); } }

Prevention

When it happens

Trigger: `mise dotfiles history show <id> --files` where the checkpoint has a snapshot but store.repo() returns None — git binary unavailable or the store lacks a git repo despite having snapshot metadata.

Common situations: Git removed from PATH after checkpoints were created; store moved/copied without its .git directory; CI containers lacking git.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/24a0efb7a936cb0d. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/dotfiles/history/show.rs:148

        }
        for incomplete in &coverage.incomplete {
            miseprintln!("  incomplete: {} ({})", incomplete.path, incomplete.reason);
        }
        if let Some(operation) = &c.operation
            && !operation.journal.is_empty()
        {
            miseprintln!("");
            miseprintln!("Journal:");
            for line in journal::render(&operation.journal) {
                miseprintln!("  - {line}");
            }
        }
        if self.files {
            let Some(tree) = &c.tree.snapshot else {
                bail!("checkpoint {} has no content snapshot", entry.id);
            };
            let Some(repo) = store.repo() else {
                bail!("listing snapshot files requires git");
            };
            miseprintln!("");
            miseprintln!("Files:");
            for file in repo.ls_tree(tree)? {
                let size = file.size.map(|size| size.to_string()).unwrap_or_default();
                miseprintln!(
                    "  {} {:>8} {}",
                    file.mode,
                    size,
                    crate::system::history::tracked::tree_path_to_display(&file.path)
                );
            }
        }
        Ok(())
    }
}

pub(crate) fn policy(autosave: bool) -> String {

View on GitHub (pinned to 533346cc37)