From 4b5e09e4d6061e12a2a6728e5f7cfdf2f2550e58 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 23 Jul 2016 18:35:16 +0800 Subject: [PATCH] #3181 detect situation when base branch is deleted in pull request --- README.md | 2 +- gogs.go | 2 +- routers/repo/pull.go | 8 ++++++++ templates/.VERSION | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fb29684ae8..527a9f7320 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) -##### Current tip version: 0.9.50 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) +##### Current tip version: 0.9.51 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) | Web | UI | Preview | |:-------------:|:-------:|:-------:| diff --git a/gogs.go b/gogs.go index ba014f4170..d8da7069ea 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.50.0723" +const APP_VER = "0.9.51.0723" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) 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 } diff --git a/templates/.VERSION b/templates/.VERSION index 8df80398e3..33af4b850c 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.50.0723 \ No newline at end of file +0.9.51.0723 \ No newline at end of file