summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2019-02-10 20:27:19 +0100
committerLauris BH <lauris@nix.lv>2019-02-10 21:27:19 +0200
commit9d8178b3ac5f86a64f67ab7b5dea99347a5afe72 (patch)
treeed560142815927211f7d52db859728b88f0d9734 /models/repo.go
parentc0adb5ea8bd0b2551a8c414b54ef5bc67882de55 (diff)
downloadgitea-9d8178b3ac5f86a64f67ab7b5dea99347a5afe72.tar.gz
gitea-9d8178b3ac5f86a64f67ab7b5dea99347a5afe72.zip
Add option to close issues via commit on a non master branch (#5992)
* fixes #5957 * add tests to make sure config option is respected * use already defined struct * - use migration to make the flag repo wide not for the entire gitea instance Also note that the config value can still be set so as to be able to control the value for new repositories that are to be created - fix copy/paste error in copyright header year and rearrange import - use repo config instead of server config value to determine if a commit should close an issue - update testsuite * use global config only when creating a new repository * allow repo admin toggle feature via UI * fix typo and improve testcase * fix fixtures * add DEFAULT prefix to config value * fix test
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go30
1 files changed, 16 insertions, 14 deletions
diff --git a/models/repo.go b/models/repo.go
index c0e69b0e38..848a76fe88 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -197,13 +197,14 @@ type Repository struct {
ExternalMetas map[string]string `xorm:"-"`
Units []*RepoUnit `xorm:"-"`
- IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
- ForkID int64 `xorm:"INDEX"`
- BaseRepo *Repository `xorm:"-"`
- Size int64 `xorm:"NOT NULL DEFAULT 0"`
- IndexerStatus *RepoIndexerStatus `xorm:"-"`
- IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true"`
- Topics []string `xorm:"TEXT JSON"`
+ IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
+ ForkID int64 `xorm:"INDEX"`
+ BaseRepo *Repository `xorm:"-"`
+ Size int64 `xorm:"NOT NULL DEFAULT 0"`
+ IndexerStatus *RepoIndexerStatus `xorm:"-"`
+ IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true"`
+ CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false"`
+ Topics []string `xorm:"TEXT JSON"`
CreatedUnix util.TimeStamp `xorm:"INDEX created"`
UpdatedUnix util.TimeStamp `xorm:"INDEX updated"`
@@ -1373,13 +1374,14 @@ func CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err
}
repo := &Repository{
- OwnerID: u.ID,
- Owner: u,
- Name: opts.Name,
- LowerName: strings.ToLower(opts.Name),
- Description: opts.Description,
- IsPrivate: opts.IsPrivate,
- IsFsckEnabled: !opts.IsMirror,
+ OwnerID: u.ID,
+ Owner: u,
+ Name: opts.Name,
+ LowerName: strings.ToLower(opts.Name),
+ Description: opts.Description,
+ IsPrivate: opts.IsPrivate,
+ IsFsckEnabled: !opts.IsMirror,
+ CloseIssuesViaCommitInAnyBranch: setting.Repository.DefaultCloseIssuesViaCommitsInAnyBranch,
}
sess := x.NewSession()