summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-06-16 23:47:44 +0800
committerGitHub <noreply@github.com>2022-06-16 23:47:44 +0800
commit157b4057531b99b2d3b5c086f385c830aa38354f (patch)
tree5a7f066be290cefe174b7f5ab5f48f478921a226 /services/pull
parent70ce051f1a7e266dccdd7cfd42f88a2570448770 (diff)
downloadgitea-157b4057531b99b2d3b5c086f385c830aa38354f.tar.gz
gitea-157b4057531b99b2d3b5c086f385c830aa38354f.zip
Remove legacy git code (ver < 2.0), fine tune markup tests (#19930)
* clean git support for ver < 2.0 * fine tune tests for markup (which requires git module) * remove unnecessary comments * try to fix tests * try test again * use const for GitVersionRequired instead of var * try to fix integration test * Refactor CheckAttributeReader to make a *git.Repository version * update document for commit signing with Gitea's internal gitconfig * update document for commit signing with Gitea's internal gitconfig Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/merge.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/services/pull/merge.go b/services/pull/merge.go
index aff800a1b6..e8bb3a1cdd 100644
--- a/services/pull/merge.go
+++ b/services/pull/merge.go
@@ -276,15 +276,8 @@ func rawMerge(ctx context.Context, pr *issues_model.PullRequest, doer *user_mode
return "", fmt.Errorf("Unable to write .git/info/sparse-checkout file in tmpBasePath: %v", err)
}
- var gitConfigCommand func() *git.Command
- if git.CheckGitVersionAtLeast("1.8.0") == nil {
- gitConfigCommand = func() *git.Command {
- return git.NewCommand(ctx, "config", "--local")
- }
- } else {
- gitConfigCommand = func() *git.Command {
- return git.NewCommand(ctx, "config")
- }
+ gitConfigCommand := func() *git.Command {
+ return git.NewCommand(ctx, "config", "--local")
}
// Switch off LFS process (set required, clean and smudge here also)
@@ -366,16 +359,14 @@ func rawMerge(ctx context.Context, pr *issues_model.PullRequest, doer *user_mode
// Determine if we should sign
signArg := ""
- if git.CheckGitVersionAtLeast("1.7.9") == nil {
- sign, keyID, signer, _ := asymkey_service.SignMerge(ctx, pr, doer, tmpBasePath, "HEAD", trackingBranch)
- if sign {
- signArg = "-S" + keyID
- if pr.BaseRepo.GetTrustModel() == repo_model.CommitterTrustModel || pr.BaseRepo.GetTrustModel() == repo_model.CollaboratorCommitterTrustModel {
- committer = signer
- }
- } else if git.CheckGitVersionAtLeast("2.0.0") == nil {
- signArg = "--no-gpg-sign"
+ sign, keyID, signer, _ := asymkey_service.SignMerge(ctx, pr, doer, tmpBasePath, "HEAD", trackingBranch)
+ if sign {
+ signArg = "-S" + keyID
+ if pr.BaseRepo.GetTrustModel() == repo_model.CommitterTrustModel || pr.BaseRepo.GetTrustModel() == repo_model.CollaboratorCommitterTrustModel {
+ committer = signer
}
+ } else {
+ signArg = "--no-gpg-sign"
}
commitTimeStr := time.Now().Format(time.RFC3339)