From ce1b8216c8a2de4cec77a032c82db825493f21ca Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 28 May 2024 15:36:02 +0800 Subject: [PATCH] * [bug#50305,0.3h] add tips for gogs branch is exists. --- lib/scm/gogs.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/scm/gogs.class.php b/lib/scm/gogs.class.php index 7daa11739e..5d54d92f82 100644 --- a/lib/scm/gogs.class.php +++ b/lib/scm/gogs.class.php @@ -188,6 +188,9 @@ class gogsRepo */ public function createBranch($branchName = '', $ref = 'master') { + $branches = $this->branch(); + if(isset($branches[$branchName])) return array('result' => 'fail', 'message' => 'Branch is exists'); + chdir($this->root); execCmd(escapeCmd("{$this->client} stash")); $res = execCmd(escapeCmd("{$this->client} checkout -b {$branchName} origin/{$ref}"), 'array');