forked from p85947160/gitea
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/
|
||||
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
|
||||
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
|
||||
[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.
|
||||
- `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
|
||||
- `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_DELAY`: **5s**: Only print verbose information if push takes longer than this delay.
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ var (
|
|||
VerbosePushDelay time.Duration
|
||||
GCArgs []string `ini:"GC_ARGS" delim:" "`
|
||||
EnableAutoGitWireProtocol bool
|
||||
PullRequestPushMessage bool
|
||||
Timeout struct {
|
||||
Default int
|
||||
Migrate int
|
||||
|
@ -42,6 +43,7 @@ var (
|
|||
VerbosePushDelay: 5 * time.Second,
|
||||
GCArgs: []string{},
|
||||
EnableAutoGitWireProtocol: true,
|
||||
PullRequestPushMessage: true,
|
||||
Timeout: struct {
|
||||
Default int
|
||||
Migrate int
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
"code.gitea.io/gitea/modules/repofiles"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
"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)
|
||||
}
|
||||
results = append(results, private.HookPostReceiveBranchResult{
|
||||
Message: true,
|
||||
Message: setting.Git.PullRequestPushMessage && repo.AllowsPulls(),
|
||||
Create: true,
|
||||
Branch: branch,
|
||||
URL: fmt.Sprintf("%s/compare/%s...%s", baseRepo.HTMLURL(), util.PathEscapeSegments(baseRepo.DefaultBranch), util.PathEscapeSegments(branch)),
|
||||
})
|
||||
} else {
|
||||
results = append(results, private.HookPostReceiveBranchResult{
|
||||
Message: true,
|
||||
Message: setting.Git.PullRequestPushMessage && repo.AllowsPulls(),
|
||||
Create: false,
|
||||
Branch: branch,
|
||||
URL: fmt.Sprintf("%s/pulls/%d", baseRepo.HTMLURL(), pr.Index),
|
||||
|
|
Loading…
Reference in New Issue