Skip to content

Commit ee6d512

Browse files
6543lunnylafriks
authored
On Tag/Branch Exist Check, dont panic if repo is nil (#21787) (#21789)
Backport #21787 Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent 8188cdf commit ee6d512

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)