From 8fdbff2f8c69886e63587ed058c84675f4e35d8d Mon Sep 17 00:00:00 2001 From: chaideqing Date: Thu, 8 Jun 2023 09:48:27 +0800 Subject: [PATCH] * Fix bug#34051. --- lib/scm/scm.class.php | 4 +++- module/repo/model.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/scm/scm.class.php b/lib/scm/scm.class.php index 5868756bc4..2527a5d021 100644 --- a/lib/scm/scm.class.php +++ b/lib/scm/scm.class.php @@ -15,7 +15,9 @@ class scm $className = $repo->SCM; if($className == 'Git') $className = 'GitRepo'; if(!class_exists($className)) require(strtolower($className) . '.class.php'); - $this->engine = new $className($repo->client, $repo->path, $repo->account, $repo->password, $repo->encoding, $repo); + $repoRoot = $repo->path; + if('Subversion' == $className && !empty($repo->prefix)) $repoRoot = substr($repo->path, 0, strlen($repo->path) - strlen($repo->prefix)); + $this->engine = new $className($repo->client, $repoRoot, $repo->account, $repo->password, $repo->encoding, $repo); } /** diff --git a/module/repo/model.php b/module/repo/model.php index ac81c7028a..af68b39c41 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -1036,7 +1036,7 @@ class repoModel extends model $file->repo = $repoID; $this->dao->insert(TABLE_REPOFILES)->data($file)->exec(); - if($file->oldPath and $file->action == 'R') + if($file->action == 'R' && !empty($file->oldPath)) { $file->path = $file->oldPath; $file->parent = dirname($file->path); @@ -1100,7 +1100,7 @@ class repoModel extends model $repoFile->parent = $parentPath == '\\' ? '/' : $parentPath; $repoFile->type = $info['kind']; $repoFile->action = $info['action']; - $repoFile->oldPath = $info['oldPath']; + $repoFile->oldPath = empty($info['oldPath']) ? '' : $info['oldPath']; $this->dao->insert(TABLE_REPOFILES)->data($repoFile)->exec(); if($repoFile->oldPath and $repoFile->action == 'R')