aboutsummaryrefslogtreecommitdiff
path: root/internal/db/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/pull.go')
-rw-r--r--internal/db/pull.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/db/pull.go b/internal/db/pull.go
index 331bc3dd..b1046715 100644
--- a/internal/db/pull.go
+++ b/internal/db/pull.go
@@ -219,8 +219,12 @@ 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 := 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))
+ if err = os.MkdirAll(filepath.Dir(tmpBasePath), os.ModePerm); err != nil {
+ return err
+ }
+ defer func() {
+ _ = os.RemoveAll(filepath.Dir(tmpBasePath))
+ }()
// Clone the base repository to the defined temporary directory,
// and checks out to base branch directly.
@@ -845,7 +849,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
// TODO: test more pull requests at same time.
func TestPullRequests() {
prs := make([]*PullRequest, 0, 10)
- x.Iterate(PullRequest{
+ _ = x.Iterate(PullRequest{
Status: PULL_REQUEST_STATUS_CHECKING,
},
func(idx int, bean interface{}) error {