Skip to content

Commit efc90b5

Browse files
committed
gogs/gogs#3233 code clean up
1 parent 18dd87d commit efc90b5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111
)
1212

13-
const _VERSION = "0.3.4"
13+
const _VERSION = "0.3.5"
1414

1515
func Version() string {
1616
return _VERSION

repo.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, err
4343
return l, nil
4444
}
4545

46+
// IsRepoURLAccessible checks if given repository URL is accessible.
47+
func IsRepoURLAccessible(url string) bool {
48+
_, err := NewCommand("ls-remote", "-q", "-h", url, "HEAD").Run()
49+
if err != nil {
50+
return false
51+
}
52+
return true
53+
}
54+
4655
// InitRepository initializes a new Git repository.
4756
func InitRepository(repoPath string, bare bool) error {
4857
os.MkdirAll(repoPath, os.ModePerm)
@@ -141,9 +150,9 @@ func Push(repoPath, remote, branch string) error {
141150
}
142151

143152
type CheckoutOptions struct {
144-
Branch string
153+
Branch string
145154
OldBranch string
146-
Timeout time.Duration
155+
Timeout time.Duration
147156
}
148157

149158
// Checkout checkouts a branch

0 commit comments

Comments
 (0)