From aa5af86036d0473caab074b70cd16337ca0e201a Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 29 Aug 2023 08:49:44 +0000 Subject: [PATCH] * Fix bug#36175 --- module/gitlab/model.php | 3 ++- module/repo/model.php | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 20626a190a..44dc302e1e 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -2971,7 +2971,8 @@ class gitlabModel extends model $project = $this->apiGetSingleProject($gitlabID, $projectID); if(is_object($project) and !empty($project->web_url)) { - return $this->dao->update(TABLE_REPO)->set('path')->eq($project->web_url)->where('id')->eq($repoID)->exec(); + $this->dao->update(TABLE_REPO)->set('path')->eq($project->web_url)->where('id')->eq($repoID)->exec(); + return true; } return false; diff --git a/module/repo/model.php b/module/repo/model.php index 92f19920b5..a114990e16 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -331,12 +331,11 @@ class repoModel extends model $data = fixer::input('post') ->setIf($isPipelineServer, 'password', $this->post->serviceToken) - ->setIf($this->post->SCM == 'Gitlab', 'path', '') + ->setDefault('client', 'svn') ->setIf($this->post->SCM == 'Gitlab', 'client', '') ->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->serviceProject) ->setDefault('prefix', $repo->prefix) ->setIf($this->post->SCM == 'Gitlab', 'prefix', '') - ->setDefault('client', 'svn') ->setDefault('product', '') ->skipSpecial('path,client,account,password,desc') ->join('product', ',') @@ -375,12 +374,17 @@ class repoModel extends model $this->rmClientVersionFile(); - if($data->SCM == 'Gitlab') $data->path = $this->getByID($id)->path; + if($data->SCM == 'Gitlab') + { + $this->loadModel('gitlab')->updateCodePath($data->serviceHost, $data->serviceProject, $repo->id); + $data->path = $this->getByID($id)->path; + } if($repo->path != $data->path) { $this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($id)->exec(); $this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($id)->exec(); + $this->dao->delete()->from(TABLE_REPOBRANCH)->where('repo')->eq($id)->exec(); return false; }