|
|
@@ -428,6 +428,20 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare |
|
|
|
|
|
|
|
sha, err := baseGitRepo.GetRefCommitID(pull.GetGitRefName()) |
|
|
|
if err != nil { |
|
|
|
if git.IsErrNotExist(err) { |
|
|
|
ctx.Data["IsPullRequestBroken"] = true |
|
|
|
if pull.IsSameRepo() { |
|
|
|
ctx.Data["HeadTarget"] = pull.HeadBranch |
|
|
|
} else if pull.HeadRepo == nil { |
|
|
|
ctx.Data["HeadTarget"] = "<deleted>:" + pull.HeadBranch |
|
|
|
} else { |
|
|
|
ctx.Data["HeadTarget"] = pull.HeadRepo.OwnerName + ":" + pull.HeadBranch |
|
|
|
} |
|
|
|
ctx.Data["BaseTarget"] = pull.BaseBranch |
|
|
|
ctx.Data["NumCommits"] = 0 |
|
|
|
ctx.Data["NumFiles"] = 0 |
|
|
|
return nil |
|
|
|
} |
|
|
|
ctx.ServerError(fmt.Sprintf("GetRefCommitID(%s)", pull.GetGitRefName()), err) |
|
|
|
return nil |
|
|
|
} |
|
|
@@ -462,12 +476,10 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare |
|
|
|
ctx.Data["IsPullRequestBroken"] = true |
|
|
|
if pull.IsSameRepo() { |
|
|
|
ctx.Data["HeadTarget"] = pull.HeadBranch |
|
|
|
} else if pull.HeadRepo == nil { |
|
|
|
ctx.Data["HeadTarget"] = "<deleted>:" + pull.HeadBranch |
|
|
|
} else { |
|
|
|
if pull.HeadRepo == nil { |
|
|
|
ctx.Data["HeadTarget"] = "<deleted>:" + pull.HeadBranch |
|
|
|
} else { |
|
|
|
ctx.Data["HeadTarget"] = pull.HeadRepo.OwnerName + ":" + pull.HeadBranch |
|
|
|
} |
|
|
|
ctx.Data["HeadTarget"] = pull.HeadRepo.OwnerName + ":" + pull.HeadBranch |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -950,6 +962,16 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm) |
|
|
|
if models.IsErrUserDoesNotHaveAccessToRepo(err) { |
|
|
|
ctx.Error(400, "UserDoesNotHaveAccessToRepo", err.Error()) |
|
|
|
return |
|
|
|
} else if git.IsErrPushRejected(err) { |
|
|
|
pushrejErr := err.(*git.ErrPushRejected) |
|
|
|
message := pushrejErr.Message |
|
|
|
if len(message) == 0 { |
|
|
|
ctx.Flash.Error(ctx.Tr("repo.pulls.push_rejected_no_message")) |
|
|
|
} else { |
|
|
|
ctx.Flash.Error(ctx.Tr("repo.pulls.push_rejected", utils.SanitizeFlashErrorString(pushrejErr.Message))) |
|
|
|
} |
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index)) |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.ServerError("NewPullRequest", err) |
|
|
|
return |