Use Slug instead of Name for Bitbucket repos.

This commit is contained in:
Ørjan Bruland 2015-01-16 17:36:56 +01:00
parent f79762177c
commit 570a23f952

View file

@ -155,16 +155,16 @@ func (r *Bitbucket) GetRepos(user *model.User) ([]*model.Repo, error) {
// these are the urls required to clone the repository // these are the urls required to clone the repository
// TODO use the bitbucketurl.Host and bitbucketurl.Scheme instead of hardcoding // TODO use the bitbucketurl.Host and bitbucketurl.Scheme instead of hardcoding
// so that we can support Stash. // so that we can support Stash.
var html = fmt.Sprintf("https://bitbucket.org/%s/%s", item.Owner, item.Name) var html = fmt.Sprintf("https://bitbucket.org/%s/%s", item.Owner, item.Slug)
var clone = fmt.Sprintf("https://bitbucket.org/%s/%s.git", item.Owner, item.Name) var clone = fmt.Sprintf("https://bitbucket.org/%s/%s.git", item.Owner, item.Slug)
var ssh = fmt.Sprintf("git@bitbucket.org:%s/%s.git", item.Owner, item.Name) var ssh = fmt.Sprintf("git@bitbucket.org:%s/%s.git", item.Owner, item.Slug)
var repo = model.Repo{ var repo = model.Repo{
UserID: user.ID, UserID: user.ID,
Remote: remote, Remote: remote,
Host: hostname, Host: hostname,
Owner: item.Owner, Owner: item.Owner,
Name: item.Name, Name: item.Slug,
Private: item.Private, Private: item.Private,
URL: html, URL: html,
CloneURL: clone, CloneURL: clone,
@ -261,7 +261,7 @@ func (r *Bitbucket) ParseHook(req *http.Request) (*model.Hook, error) {
return &model.Hook{ return &model.Hook{
Owner: hook.Repo.Owner, Owner: hook.Repo.Owner,
Repo: hook.Repo.Name, Repo: hook.Repo.Slug,
Sha: hook.Commits[len(hook.Commits)-1].Hash, Sha: hook.Commits[len(hook.Commits)-1].Hash,
Branch: hook.Commits[len(hook.Commits)-1].Branch, Branch: hook.Commits[len(hook.Commits)-1].Branch,
Author: author, Author: author,