diff options
author | skyblue <ssx205@gmail.com> | 2014-04-03 11:13:44 +0800 |
---|---|---|
committer | skyblue <ssx205@gmail.com> | 2014-04-03 11:13:44 +0800 |
commit | bbadbbdf685a7f6cb1924442a115aa88bb520e07 (patch) | |
tree | bc3f500110d3ed49b84d742fd85ee36201098c1b /models | |
parent | bfdadaa13c5dc289beed8e13c6e0d8a0eabeae37 (diff) | |
parent | 1757a59a999be2c1b3a17244231cad6a579282d4 (diff) | |
download | gitea-bbadbbdf685a7f6cb1924442a115aa88bb520e07.tar.gz gitea-bbadbbdf685a7f6cb1924442a115aa88bb520e07.zip |
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'models')
-rw-r--r-- | models/git.go | 19 | ||||
-rw-r--r-- | models/repo.go | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/models/git.go b/models/git.go index d3bad6e0ce..46345d0ffc 100644 --- a/models/git.go +++ b/models/git.go @@ -56,6 +56,25 @@ func GetBranches(userName, repoName string) ([]string, error) { return brs, nil } +// GetTags returns all tags of given repository. +func GetTags(userName, repoName string) ([]string, error) { + repo, err := git.OpenRepository(RepoPath(userName, repoName)) + if err != nil { + return nil, err + } + + refs, err := repo.AllTags() + if err != nil { + return nil, err + } + + tags := make([]string, len(refs)) + for i, ref := range refs { + tags[i] = ref.Name + } + return tags, nil +} + func IsBranchExist(userName, repoName, branchName string) bool { repo, err := git.OpenRepository(RepoPath(userName, repoName)) if err != nil { diff --git a/models/repo.go b/models/repo.go index 0c808f1845..e3270b1838 100644 --- a/models/repo.go +++ b/models/repo.go @@ -74,6 +74,7 @@ type Repository struct { NumStars int NumForks int NumIssues int + NumReleases int `xorm:"NOT NULL"` NumClosedIssues int NumOpenIssues int `xorm:"-"` IsPrivate bool @@ -513,6 +514,7 @@ func NotifyWatchers(act *Action) error { continue } + act.Id = 0 act.UserId = watches[i].UserId if _, err = orm.InsertOne(act); err != nil { return errors.New("repo.NotifyWatchers(create action): " + err.Error()) |