chant/repository/
git_repository.rs1use anyhow::Result;
2
3pub trait GitRepository {
5 fn get_current_branch(&self) -> Result<String>;
7
8 fn branch_exists(&self, name: &str) -> Result<bool>;
10}
11
12pub struct CommandGitRepository;
14
15impl CommandGitRepository {
16 pub fn new() -> Self {
18 Self
19 }
20}
21
22impl Default for CommandGitRepository {
23 fn default() -> Self {
24 Self::new()
25 }
26}
27
28impl GitRepository for CommandGitRepository {
29 fn get_current_branch(&self) -> Result<String> {
30 crate::git::get_current_branch()
31 }
32
33 fn branch_exists(&self, name: &str) -> Result<bool> {
34 crate::git::branch_exists(name)
35 }
36}