mirror of
https://github.com/go-gitea/gitea
synced 2024-11-10 20:24:24 +00:00
Make PR message on pushes configurable (#10664)
* Make PR message on pushes configurable * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
b40428a50a
commit
de63ac046e
@ -870,7 +870,9 @@ MAX_GIT_DIFF_FILES = 100
|
|||||||
; see more on http://git-scm.com/docs/git-gc/
|
; see more on http://git-scm.com/docs/git-gc/
|
||||||
GC_ARGS =
|
GC_ARGS =
|
||||||
; If use git wire protocol version 2 when git version >= 2.18, default is true, set to false when you always want git wire protocol version 1
|
; If use git wire protocol version 2 when git version >= 2.18, default is true, set to false when you always want git wire protocol version 1
|
||||||
EnableAutoGitWireProtocol = true
|
ENABLE_AUTO_GIT_WIRE_PROTOCOL = true
|
||||||
|
; Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled)
|
||||||
|
PULL_REQUEST_PUSH_MESSAGE = true
|
||||||
|
|
||||||
; Operation timeout in seconds
|
; Operation timeout in seconds
|
||||||
[git.timeout]
|
[git.timeout]
|
||||||
|
@ -541,6 +541,7 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
|
|||||||
- `MAX_GIT_DIFF_FILES`: **100**: Max number of files shown in diff view.
|
- `MAX_GIT_DIFF_FILES`: **100**: Max number of files shown in diff view.
|
||||||
- `GC_ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. See more on http://git-scm.com/docs/git-gc/
|
- `GC_ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. See more on http://git-scm.com/docs/git-gc/
|
||||||
- `ENABLE_AUTO_GIT_WIRE_PROTOCOL`: **true**: If use git wire protocol version 2 when git version >= 2.18, default is true, set to false when you always want git wire protocol version 1
|
- `ENABLE_AUTO_GIT_WIRE_PROTOCOL`: **true**: If use git wire protocol version 2 when git version >= 2.18, default is true, set to false when you always want git wire protocol version 1
|
||||||
|
- `PULL_REQUEST_PUSH_MESSAGE`: **true**: Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled)
|
||||||
- `VERBOSE_PUSH`: **true**: Print status information about pushes as they are being processed.
|
- `VERBOSE_PUSH`: **true**: Print status information about pushes as they are being processed.
|
||||||
- `VERBOSE_PUSH_DELAY`: **5s**: Only print verbose information if push takes longer than this delay.
|
- `VERBOSE_PUSH_DELAY`: **5s**: Only print verbose information if push takes longer than this delay.
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ var (
|
|||||||
VerbosePushDelay time.Duration
|
VerbosePushDelay time.Duration
|
||||||
GCArgs []string `ini:"GC_ARGS" delim:" "`
|
GCArgs []string `ini:"GC_ARGS" delim:" "`
|
||||||
EnableAutoGitWireProtocol bool
|
EnableAutoGitWireProtocol bool
|
||||||
|
PullRequestPushMessage bool
|
||||||
Timeout struct {
|
Timeout struct {
|
||||||
Default int
|
Default int
|
||||||
Migrate int
|
Migrate int
|
||||||
@ -42,6 +43,7 @@ var (
|
|||||||
VerbosePushDelay: 5 * time.Second,
|
VerbosePushDelay: 5 * time.Second,
|
||||||
GCArgs: []string{},
|
GCArgs: []string{},
|
||||||
EnableAutoGitWireProtocol: true,
|
EnableAutoGitWireProtocol: true,
|
||||||
|
PullRequestPushMessage: true,
|
||||||
Timeout: struct {
|
Timeout: struct {
|
||||||
Default int
|
Default int
|
||||||
Migrate int
|
Migrate int
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
"code.gitea.io/gitea/modules/repofiles"
|
"code.gitea.io/gitea/modules/repofiles"
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
pull_service "code.gitea.io/gitea/services/pull"
|
pull_service "code.gitea.io/gitea/services/pull"
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
"gopkg.in/src-d/go-git.v4/plumbing"
|
||||||
@ -428,14 +429,14 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
|
|||||||
branch = fmt.Sprintf("%s:%s", repo.OwnerName, branch)
|
branch = fmt.Sprintf("%s:%s", repo.OwnerName, branch)
|
||||||
}
|
}
|
||||||
results = append(results, private.HookPostReceiveBranchResult{
|
results = append(results, private.HookPostReceiveBranchResult{
|
||||||
Message: true,
|
Message: setting.Git.PullRequestPushMessage && repo.AllowsPulls(),
|
||||||
Create: true,
|
Create: true,
|
||||||
Branch: branch,
|
Branch: branch,
|
||||||
URL: fmt.Sprintf("%s/compare/%s...%s", baseRepo.HTMLURL(), util.PathEscapeSegments(baseRepo.DefaultBranch), util.PathEscapeSegments(branch)),
|
URL: fmt.Sprintf("%s/compare/%s...%s", baseRepo.HTMLURL(), util.PathEscapeSegments(baseRepo.DefaultBranch), util.PathEscapeSegments(branch)),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
results = append(results, private.HookPostReceiveBranchResult{
|
results = append(results, private.HookPostReceiveBranchResult{
|
||||||
Message: true,
|
Message: setting.Git.PullRequestPushMessage && repo.AllowsPulls(),
|
||||||
Create: false,
|
Create: false,
|
||||||
Branch: branch,
|
Branch: branch,
|
||||||
URL: fmt.Sprintf("%s/pulls/%d", baseRepo.HTMLURL(), pr.Index),
|
URL: fmt.Sprintf("%s/pulls/%d", baseRepo.HTMLURL(), pr.Index),
|
||||||
|
Loading…
Reference in New Issue
Block a user