aboutsummaryrefslogtreecommitdiff
path: root/internal/db/pull.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-22 09:05:26 +0800
committerGitHub <noreply@github.com>2020-02-22 09:05:26 +0800
commit648d9e253c1924b832248f26fee42b2fb64dc3bc (patch)
tree51649fad974cd7284a47d30e412c90e7ab72cd2c /internal/db/pull.go
parent5b14cc6f0b7b661beb2640a94bd15660cdb48587 (diff)
conf: overhaul server settings (#5928)
* conf: rename package * Requires Go 1.12 * Fix lint * Fix lint * Overhaul * db: fix tests * Save my work * Fix tests * Server.UnixSocketPermission * Server.LocalRootURL * SSH settings * Server.OfflineMode * Save my work * App.Version * Remove [server] STATIC_ROOT_PATH * Server.LandingURL
Diffstat (limited to 'internal/db/pull.go')
-rw-r--r--internal/db/pull.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/db/pull.go b/internal/db/pull.go
index 268927eb..b617a8c7 100644
--- a/internal/db/pull.go
+++ b/internal/db/pull.go
@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"path"
+ "path/filepath"
"strings"
"time"
@@ -18,14 +19,14 @@ import (
"github.com/gogs/git-module"
api "github.com/gogs/go-gogs-client"
+ "gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/db/errors"
"gogs.io/gogs/internal/osutil"
"gogs.io/gogs/internal/process"
- "gogs.io/gogs/internal/setting"
"gogs.io/gogs/internal/sync"
)
-var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLength)
+var PullRequestQueue = sync.NewUniqueQueue(conf.Repository.PullRequestQueueLength)
type PullRequestType int
@@ -218,9 +219,9 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
// Create temporary directory to store temporary copy of the base repository,
// and clean it up when operation finished regardless of succeed or not.
- tmpBasePath := path.Join(setting.AppDataPath, "tmp/repos", com.ToStr(time.Now().Nanosecond())+".git")
- os.MkdirAll(path.Dir(tmpBasePath), os.ModePerm)
- defer os.RemoveAll(path.Dir(tmpBasePath))
+ tmpBasePath := filepath.Join(conf.Server.AppDataPath, "tmp", "repos", com.ToStr(time.Now().Nanosecond())+".git")
+ os.MkdirAll(filepath.Dir(tmpBasePath), os.ModePerm)
+ defer os.RemoveAll(filepath.Dir(tmpBasePath))
// Clone the base repository to the defined temporary directory,
// and checks out to base branch directly.
@@ -378,7 +379,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
Ref: git.BRANCH_PREFIX + pr.BaseBranch,
Before: pr.MergeBase,
After: mergeCommit.ID.String(),
- CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
+ CompareURL: conf.Server.ExternalURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
Commits: commits,
Repo: pr.BaseRepo.APIFormat(nil),
Pusher: pr.HeadRepo.MustOwner().APIFormat(),