* Make PR message on pushes configurable * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com>tags/v1.12.0-dev
; 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] |
- `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. | ||||
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 | ||||
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 |
"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" | ||||
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), |