issue_closing_pattern.md 1,9 КБ
Newer Older
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
1
# Issue closing pattern **(CORE ONLY)**
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
2
3
4
5
6
7
8
9
10
11
12
13
14
15

>**Note:**
This is the administration documentation.
There is a separate [user documentation] on issue closing pattern.

When a commit or merge request resolves one or more issues, it is possible to
automatically have these issues closed when the commit or merge request lands
in the project's default branch.

## Change the issue closing pattern

In order to change the pattern you need to have access to the server that GitLab
is installed on.

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
16
The default pattern can be located in [`gitlab.yml.example`] under the
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
17
18
19
"Automatic issue closing" section.

> **Tip:**
Evan Read's avatar
Evan Read включено в состав коммита
20
You are advised to use <http://rubular.com> to test the issue closing pattern.
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
21
22
23
24
25
26
Because Rubular doesn't understand `%{issue_ref}`, you can replace this by
`#\d+` when testing your patterns, which matches only local issue references like `#123`.

**For Omnibus installations**

1. Open `/etc/gitlab/gitlab.rb` with your editor.
Balasankar "Balu" C's avatar
Balasankar "Balu" C включено в состав коммита
27
1. Change the value of `gitlab_rails['gitlab_issue_closing_pattern']` to a regular
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
28
29
   expression of your liking:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
30
31
32
33
   ```ruby
   gitlab_rails['gitlab_issue_closing_pattern'] = "\b((?:[Cc]los(?:e[sd]|ing)|\b[Ff]ix(?:e[sd]|ing)?) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?))+)"
   ```

Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
34
35
36
37
38
39
40
1. [Reconfigure] GitLab for the changes to take effect.

**For installations from source**

1. Open `gitlab.yml` with your editor.
1. Change the value of `issue_closing_pattern`:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
41
42
43
   ```yaml
   issue_closing_pattern: "\b((?:[Cc]los(?:e[sd]|ing)|\b[Ff]ix(?:e[sd]|ing)?) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?))+)"
   ```
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
44
45
46
47
48
49

1. [Restart] GitLab for the changes to take effect.

[gitlab.yml.example]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example
[reconfigure]: restart_gitlab.md#omnibus-gitlab-reconfigure
[restart]: restart_gitlab.md#installations-from-source
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
50
[user documentation]: ../user/project/issues/managing_issues.md#closing-issues-automatically