summaryrefslogtreecommitdiffstats
path: root/routers/repo/pull.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-23 18:35:16 +0800
committerUnknwon <u@gogs.io>2016-07-23 18:35:16 +0800
commit4b5e09e4d6061e12a2a6728e5f7cfdf2f2550e58 (patch)
tree262e637c1af7e3c7c882b8bd063d17c5ff3dc325 /routers/repo/pull.go
parent4f78abe7dc85754bd913f05ed927d27a59c4a22c (diff)
downloadgitea-4b5e09e4d6061e12a2a6728e5f7cfdf2f2550e58.tar.gz
gitea-4b5e09e4d6061e12a2a6728e5f7cfdf2f2550e58.zip
#3181 detect situation when base branch is deleted in pull request
Diffstat (limited to 'routers/repo/pull.go')
-rw-r--r--routers/repo/pull.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 56245a8766..2c534f1e03 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -235,6 +235,14 @@ func PrepareViewPullInfo(ctx *context.Context, pull *models.Issue) *git.PullRequ
prInfo, err := headGitRepo.GetPullRequestInfo(models.RepoPath(repo.Owner.Name, repo.Name),
pull.BaseBranch, pull.HeadBranch)
if err != nil {
+ if strings.Contains(err.Error(), "fatal: Not a valid object name") {
+ ctx.Data["IsPullReuqestBroken"] = true
+ ctx.Data["BaseTarget"] = "deleted"
+ ctx.Data["NumCommits"] = 0
+ ctx.Data["NumFiles"] = 0
+ return nil
+ }
+
ctx.Handle(500, "GetPullRequestInfo", err)
return nil
}