On Tag/Branch Exist Check, dont panic if repo is nil (#21787) (#21789)

Backport #21787

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
pull/22028/head^2
6543 2 years ago committed by GitHub
parent 8188cdfcd2
commit ee6d5124bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/git/repo_branch_nogogit.go
  2. 2
      modules/git/repo_tag_nogogit.go

@ -53,7 +53,7 @@ func (repo *Repository) IsReferenceExist(name string) bool {
// IsBranchExist returns true if given branch exists in current repository.
func (repo *Repository) IsBranchExist(name string) bool {
if name == "" {
if repo == nil || name == "" {
return false
}

@ -16,7 +16,7 @@ import (
// IsTagExist returns true if given tag exists in the repository.
func (repo *Repository) IsTagExist(name string) bool {
if name == "" {
if repo == nil || name == "" {
return false
}

Loading…
Cancel
Save