Skip to content

Commit 9819a47

Browse files
authored
On tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)
backport #21787
1 parent c7770fa commit 9819a47

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/git/repo_branch_nogogit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (repo *Repository) IsReferenceExist(name string) bool {
5353

5454
// IsBranchExist returns true if given branch exists in current repository.
5555
func (repo *Repository) IsBranchExist(name string) bool {
56-
if name == "" {
56+
if repo == nil || name == "" {
5757
return false
5858
}
5959

modules/git/repo_tag_nogogit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// IsTagExist returns true if given tag exists in the repository.
1818
func (repo *Repository) IsTagExist(name string) bool {
19-
if name == "" {
19+
if repo == nil || name == "" {
2020
return false
2121
}
2222

0 commit comments

Comments
 (0)