summaryrefslogtreecommitdiffstats
path: root/models/release.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-12-31 19:51:12 +0800
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-01-03 02:27:38 +0100
commit3c7116382ff4783a89c443b7b36c30d27b9c461c (patch)
tree2b4463084bf3b86f371902de646acead80a006a0 /models/release.go
parent727675dd46c0b24edd45e1aa710b6b49bb9be202 (diff)
downloadgitea-3c7116382ff4783a89c443b7b36c30d27b9c461c.tar.gz
gitea-3c7116382ff4783a89c443b7b36c30d27b9c461c.zip
change the default action when deleting a release to not delete tag
Diffstat (limited to 'models/release.go')
-rw-r--r--models/release.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/models/release.go b/models/release.go
index bb5f43407b..428b79e45f 100644
--- a/models/release.go
+++ b/models/release.go
@@ -249,7 +249,7 @@ func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error) {
}
// DeleteReleaseByID deletes a release and corresponding Git tag by given ID.
-func DeleteReleaseByID(id int64, u *User) error {
+func DeleteReleaseByID(id int64, u *User, delTag bool) error {
rel, err := GetReleaseByID(id)
if err != nil {
return fmt.Errorf("GetReleaseByID: %v", err)
@@ -267,11 +267,13 @@ func DeleteReleaseByID(id int64, u *User) error {
return fmt.Errorf("DeleteReleaseByID: permission denied")
}
- _, stderr, err := process.ExecDir(-1, repo.RepoPath(),
- fmt.Sprintf("DeleteReleaseByID (git tag -d): %d", rel.ID),
- "git", "tag", "-d", rel.TagName)
- if err != nil && !strings.Contains(stderr, "not found") {
- return fmt.Errorf("git tag -d: %v - %s", err, stderr)
+ if delTag {
+ _, stderr, err := process.ExecDir(-1, repo.RepoPath(),
+ fmt.Sprintf("DeleteReleaseByID (git tag -d): %d", rel.ID),
+ "git", "tag", "-d", rel.TagName)
+ if err != nil && !strings.Contains(stderr, "not found") {
+ return fmt.Errorf("git tag -d: %v - %s", err, stderr)
+ }
}
if _, err = x.Id(rel.ID).Delete(new(Release)); err != nil {