From e4bd2b2d01bde7140d2d757b7d7c95b80cbc3f46 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 10:56:02 +0800 Subject: [PATCH] * fix for get branches from gitlab. --- lib/scm/gitlab.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 36cd0ac41e..a5c472ed06 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -169,10 +169,15 @@ class gitlab $list = $this->fetch($api, $params); if(empty($list)) break; - foreach($list as $branch) $branches[$branch->name] = $branch->name; + foreach($list as $branch) + { + if(!isset($branch->name)) continue; + $branches[$branch->name] = $branch->name; + } if(count($list) < $params['per_page']) break; } + if(empty($branches)) $branches['master'] = 'master'; asort($branches); return $branches; }