-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub Enterprise Support #23
Changes from all commits
2f48023
b7a9c7f
017560f
0c1a5cf
52554b4
99c12a2
65bbbb4
7e89478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,9 +73,9 @@ func (r *Repo) IsGit() bool { | |
return true | ||
case strings.HasPrefix(r.Path, "ssh:https://git@"): | ||
return true | ||
case strings.HasPrefix(r.Path, "https://github.com/"): | ||
case strings.HasPrefix(r.Path, "https://github"): | ||
return true | ||
case strings.HasPrefix(r.Path, "http:https://github.com"): | ||
case strings.HasPrefix(r.Path, "http:https://github"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do see there is a second check for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is never used in code, but I try'd to change it just in case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe it was once used but never got deleted once the use-case went away. @bradrydzewski, is it OK to delete? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we added the code in anticipation of bitbucket support to differentiate between hg and git. I'll be adding bitbucket this week. it may turn out that we don't need it, in which case I'll remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
👍 |
||
return true | ||
case strings.HasSuffix(r.Path, ".git"): | ||
return true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ const ( | |
) | ||
|
||
const ( | ||
HostGithub = "github.com" | ||
HostBitbucket = "bitbucket.org" | ||
HostGoogle = "code.google.com" | ||
HostCustom = "custom" | ||
|
@@ -25,8 +24,8 @@ const ( | |
) | ||
|
||
const ( | ||
githubRepoPattern = "git:https://github.com/%s/%s.git" | ||
githubRepoPatternPrivate = "git@github.com:%s/%s.git" | ||
githubRepoPattern = "git:https://%s/%s/%s.git" | ||
githubRepoPatternPrivate = "git@%s:%s/%s.git" | ||
bitbucketRepoPattern = "https://bitbucket.org/%s/%s.git" | ||
bitbucketRepoPatternPrivate = "[email protected]:%s/%s.git" | ||
) | ||
|
@@ -122,15 +121,15 @@ func NewRepo(host, owner, name, scm, url string) (*Repo, error) { | |
} | ||
|
||
// Creates a new GitHub repository | ||
func NewGitHubRepo(owner, name string, private bool) (*Repo, error) { | ||
func NewGitHubRepo(domain, owner, name string, private bool) (*Repo, error) { | ||
var url string | ||
switch private { | ||
case false: | ||
url = fmt.Sprintf(githubRepoPattern, owner, name) | ||
url = fmt.Sprintf(githubRepoPattern, domain, owner, name) | ||
case true: | ||
url = fmt.Sprintf(githubRepoPatternPrivate, owner, name) | ||
url = fmt.Sprintf(githubRepoPatternPrivate, domain, owner, name) | ||
} | ||
return NewRepo(HostGithub, owner, name, ScmGit, url) | ||
return NewRepo(domain, owner, name, ScmGit, url) | ||
} | ||
|
||
// Creates a new Bitbucket repository | ||
|
@@ -142,7 +141,7 @@ func NewBitbucketRepo(owner, name string, private bool) (*Repo, error) { | |
case true: | ||
url = fmt.Sprintf(bitbucketRepoPatternPrivate, owner, name) | ||
} | ||
return NewRepo(HostGithub, owner, name, ScmGit, url) | ||
return NewRepo(HostBitbucket, owner, name, ScmGit, url) | ||
} | ||
|
||
func (r *Repo) DefaultBranch() string { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if perhaps we don't need this particular branch in the validation?
Seems like
case strings.HasSuffix(r.Path, ".git")
should be enough whilehttps://github.com/
might be a bit superfluous since I don't believe there is any restriction on hosted github's hostname having to be prefixed withhttps://github
(though it is a nice convention). I believe it is optional to usehttps
(though it is recommended AFAIK).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, I don't see a perfect way to check for a subversion URL repo which github also supports.