@@ -41,19 +41,25 @@ impl GitService {
4141
4242 pub fn load_or_clone ( config : Arc < Config > ) -> Result < Self , GitServiceError > {
4343 let repo_path = PathBuf :: from ( config. base_dir . clone ( ) ) ;
44- if repo_path. exists ( ) {
44+
45+ let mut repo = if repo_path. exists ( ) {
4546 info ! ( "Repository already exists at {:?}, opening..." , repo_path) ;
46- let repo = gix:: open ( repo_path) . map_err ( GitServiceError :: FailedOpenRepository ) ?; // 既存リポジトリを開く
47- let service = Self { repo, config } ;
48- service. check_repo_remote_conf ( service. repo . clone ( ) ) ?;
49- Ok ( service)
47+ gix:: open ( repo_path) . map_err ( GitServiceError :: FailedOpenRepository ) ?
5048 } else {
5149 info ! ( "Repository does not exist at {:?}, cloning..." , repo_path) ;
5250 let auth_able_url = config. git_config . auth_able_url ( ) ;
5351 let refname = config. git_config . refname ( ) ;
54- let repo = Self :: clone_repo ( & repo_path, & auth_able_url, & refname) ?;
55- Ok ( Self { repo, config } )
56- }
52+ Self :: clone_repo ( & repo_path, & auth_able_url, & refname) ?
53+ } ;
54+
55+ repo. committer_or_set_generic_fallback ( )
56+ . map_err ( |err| GitServiceError :: FailedOperation ( format ! (
57+ "Failed to prepare committer fallback: {err}"
58+ ) ) ) ?;
59+
60+ let service = Self { repo, config } ;
61+ service. check_repo_remote_conf ( service. repo . clone ( ) ) ?;
62+ Ok ( service)
5763 }
5864
5965 pub fn update ( & self ) -> Result < String , GitServiceError > {
0 commit comments