From 22027e312722b9c100234ac098334916e1867320 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Tue, 11 Oct 2022 09:46:39 +0200
Subject: [PATCH] Fix #545

---
 app/services/git/providers/github.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/services/git/providers/github.rb b/app/services/git/providers/github.rb
index f3bdc6107..2bf52bf8d 100644
--- a/app/services/git/providers/github.rb
+++ b/app/services/git/providers/github.rb
@@ -75,7 +75,8 @@ class Git::Providers::Github < Git::Providers::Abstract
   end
 
   def default_branch
-    @default_branch ||= branch || client.repo(repository)[:default_branch]
+    @default_branch ||= branch.present? ? branch
+                                        : client.repo(repository)[:default_branch]
   end
 
   def branch_sha
-- 
GitLab