From e2c7e649a4f1ffde8ddb02bcb3fee64eee0f29fe Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 6 Dec 2016 14:54:19 +0800 Subject: [PATCH] * fix bug for git. --- module/git/control.php | 1 + module/git/model.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/git/control.php b/module/git/control.php index 549f1b4bda..be0a97f5a8 100644 --- a/module/git/control.php +++ b/module/git/control.php @@ -122,6 +122,7 @@ class git extends control $revision = trim($this->post->revision); $files = $this->post->files; if(empty($repoUrl)) die(); + $repoUrl = rtrim($repoUrl, '/') . '/'; $parsedFiles = array(); foreach($files as $file) diff --git a/module/git/model.php b/module/git/model.php index 2c414193ab..66c8ade679 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -427,7 +427,7 @@ class gitModel extends model chdir($repo->path); $subPath = substr($path, strlen($repo->path) + 1); - $subPath = ltrim('/', $subPath); + $subPath = ltrim($subPath, '/'); exec("$this->client rev-list -n 2 $revision -- $subPath", $lists); if(count($lists) == 2) list($nowRevision, $preRevision) = $lists; $cmd = "$this->client diff $preRevision $nowRevision -- $subPath"; @@ -458,7 +458,7 @@ class gitModel extends model $path = str_replace('%5C', '\\', $path); $subPath = substr($path, strlen($repo->path) + 1); - $subPath = ltrim('/', $subPath); + $subPath = ltrim($subPath, '/'); chdir($repo->path); $cmd = "$this->client show $revision:$subPath"; $code = `$cmd`;