diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-12 09:10:39 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-12 09:10:39 -0400 |
commit | 9961f9a53c4e3be1b224ad618b35c175143a0daa (patch) | |
tree | a44972bdc8e7785368d0ab05a1bf947532bdcbca /models/release.go | |
parent | 1161c71ac1f6f2030c9e21633aa127c0cbfbdccb (diff) | |
download | gitea-9961f9a53c4e3be1b224ad618b35c175143a0daa.tar.gz gitea-9961f9a53c4e3be1b224ad618b35c175143a0daa.zip |
Fix #197
Diffstat (limited to 'models/release.go')
-rw-r--r-- | models/release.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/models/release.go b/models/release.go index 314b7a91a9..e5e81b9b67 100644 --- a/models/release.go +++ b/models/release.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/Unknwon/com" + // "github.com/Unknwon/com" "github.com/gogits/git" ) @@ -26,7 +26,8 @@ type Release struct { Title string TagName string LowerTagName string - SHA1 string + Target string + Sha1 string `xorm:"VARCHAR(40)"` NumCommits int NumCommitsBehind int `xorm:"-"` Note string `xorm:"TEXT"` @@ -59,9 +60,13 @@ func CreateRelease(gitRepo *git.Repository, rel *Release) error { } if !gitRepo.IsTagExist(rel.TagName) { - _, stderr, err := com.ExecCmdDir(gitRepo.Path, "git", "tag", rel.TagName, "-m", rel.Title) + commit, err := gitRepo.GetCommitOfBranch(rel.Target) if err != nil { - return errors.New(stderr) + return err + } + + if err = gitRepo.CreateTag(rel.TagName, commit.Id.String()); err != nil { + return err } } else { commit, err := gitRepo.GetCommitOfTag(rel.TagName) |