Initialize checkpoint manager automatically (when in a git repo)
(
os: &Os,
shadow_path: impl AsRef<Path>,
current_history: &VecDeque<HistoryEntry>,
)
| 84 | impl CheckpointManager { |
| 85 | /// Initialize checkpoint manager automatically (when in a git repo) |
| 86 | pub async fn auto_init( |
| 87 | os: &Os, |
| 88 | shadow_path: impl AsRef<Path>, |
| 89 | current_history: &VecDeque<HistoryEntry>, |
| 90 | ) -> Result<Self> { |
| 91 | if !is_git_installed() { |
| 92 | bail!("Checkpoints are not available. Git is required but not installed."); |
| 93 | } |
| 94 | if !is_in_git_repo() { |
| 95 | bail!("Checkpoints are not available in this directory. Use '/checkpoint init' to enable checkpoints."); |
| 96 | } |
| 97 | |
| 98 | let manager = Self::manual_init(os, shadow_path, current_history).await?; |
| 99 | Ok(manager) |
| 100 | } |
| 101 | |
| 102 | /// Initialize checkpoint manager manually |
| 103 | pub async fn manual_init( |
nothing calls this directly
no test coverage detected