@@ -55,7 +55,7 @@ func AdoptRepository(ctx context.Context, doer, u *user_model.User, opts CreateR
5555 if err := db .WithTx (ctx , func (ctx context.Context ) error {
5656 isExist , err := gitrepo .IsRepositoryExist (ctx , repo )
5757 if err != nil {
58- log .Error ("Unable to check if %s exists. Error: %v" , repo .RepoPath (), err )
58+ log .Error ("Unable to check if %s exists. Error: %v" , repo .FullName (), err )
5959 return err
6060 }
6161 if ! isExist {
@@ -80,8 +80,7 @@ func AdoptRepository(ctx context.Context, doer, u *user_model.User, opts CreateR
8080 }
8181
8282 if err := func () error {
83- repoPath := repo_model .RepoPath (u .Name , repo .Name )
84- if err := adoptRepository (ctx , repoPath , repo , opts .DefaultBranch ); err != nil {
83+ if err := adoptRepository (ctx , repo , opts .DefaultBranch ); err != nil {
8584 return fmt .Errorf ("adoptRepository: %w" , err )
8685 }
8786
@@ -90,7 +89,7 @@ func AdoptRepository(ctx context.Context, doer, u *user_model.User, opts CreateR
9089 }
9190
9291 if stdout , _ , err := git .NewCommand ("update-server-info" ).
93- RunStdString (ctx , & git.RunOpts {Dir : repoPath }); err != nil {
92+ RunStdString (ctx , & git.RunOpts {Dir : repo . RepoPath () }); err != nil {
9493 log .Error ("CreateRepository(git update-server-info) in %v: Stdout: %s\n Error: %v" , repo , stdout , err )
9594 return fmt .Errorf ("CreateRepository(git update-server-info): %w" , err )
9695 }
@@ -106,17 +105,17 @@ func AdoptRepository(ctx context.Context, doer, u *user_model.User, opts CreateR
106105 return repo , nil
107106}
108107
109- func adoptRepository (ctx context.Context , repoPath string , repo * repo_model.Repository , defaultBranch string ) (err error ) {
110- isExist , err := util . IsExist ( repoPath )
108+ func adoptRepository (ctx context.Context , repo * repo_model.Repository , defaultBranch string ) (err error ) {
109+ isExist , err := gitrepo . IsRepositoryExist ( ctx , repo )
111110 if err != nil {
112- log .Error ("Unable to check if %s exists. Error: %v" , repoPath , err )
111+ log .Error ("Unable to check if %s exists. Error: %v" , repo . FullName () , err )
113112 return err
114113 }
115114 if ! isExist {
116- return fmt .Errorf ("adoptRepository: path does not already exist: %s" , repoPath )
115+ return fmt .Errorf ("adoptRepository: path does not already exist: %s" , repo . FullName () )
117116 }
118117
119- if err := repo_module .CreateDelegateHooks (repoPath ); err != nil {
118+ if err := repo_module .CreateDelegateHooks (repo . RepoPath () ); err != nil {
120119 return fmt .Errorf ("createDelegateHooks: %w" , err )
121120 }
122121
0 commit comments