mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 07:04:25 +00:00
#1931 Test patch does not checkout correct base branch
This commit is contained in:
parent
b4970b3cc3
commit
4f03b81ec7
@ -218,6 +218,7 @@ var patchConflicts = []string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// testPatch checks if patch can be merged to base repository without conflit.
|
// testPatch checks if patch can be merged to base repository without conflit.
|
||||||
|
// FIXME: make a mechanism to clean up stable local copies.
|
||||||
func (pr *PullRequest) testPatch() (err error) {
|
func (pr *PullRequest) testPatch() (err error) {
|
||||||
if pr.BaseRepo == nil {
|
if pr.BaseRepo == nil {
|
||||||
pr.BaseRepo, err = GetRepositoryByID(pr.BaseRepoID)
|
pr.BaseRepo, err = GetRepositoryByID(pr.BaseRepoID)
|
||||||
@ -243,8 +244,16 @@ func (pr *PullRequest) testPatch() (err error) {
|
|||||||
return fmt.Errorf("UpdateLocalCopy: %v", err)
|
return fmt.Errorf("UpdateLocalCopy: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pr.Status = PULL_REQUEST_STATUS_CHECKING
|
// Checkout base branch.
|
||||||
_, stderr, err := process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(),
|
_, stderr, err := process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(),
|
||||||
|
fmt.Sprintf("PullRequest.Merge(git checkout): %s", pr.BaseRepo.ID),
|
||||||
|
"git", "checkout", pr.BaseBranch)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("git checkout: %s", stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
pr.Status = PULL_REQUEST_STATUS_CHECKING
|
||||||
|
_, stderr, err = process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(),
|
||||||
fmt.Sprintf("testPatch(git apply --check): %d", pr.BaseRepo.ID),
|
fmt.Sprintf("testPatch(git apply --check): %d", pr.BaseRepo.ID),
|
||||||
"git", "apply", "--check", patchPath)
|
"git", "apply", "--check", patchPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -320,7 +320,7 @@ func (repo *Repository) UpdateLocalCopy() error {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, stderr, err := process.ExecDir(-1, localPath,
|
_, stderr, err := process.ExecDir(-1, localPath,
|
||||||
fmt.Sprintf("UpdateLocalCopy(git pull): %s", repoPath), "git", "pull")
|
fmt.Sprintf("UpdateLocalCopy(git pull --all): %s", repoPath), "git", "pull", "--all")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("git pull: %v - %s", err, stderr)
|
return fmt.Errorf("git pull: %v - %s", err, stderr)
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,6 @@ func RepoRef() macaron.Handler {
|
|||||||
return func(ctx *Context) {
|
return func(ctx *Context) {
|
||||||
// Empty repository does not have reference information.
|
// Empty repository does not have reference information.
|
||||||
if ctx.Repo.Repository.IsBare {
|
if ctx.Repo.Repository.IsBare {
|
||||||
ctx.Data["CommitsCount"] = 0
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<div class="ui five item menu">
|
{{if not .IsBareRepo}}
|
||||||
|
<div class="ui {{if .IsRepositoryAdmin}}five{{else}}four{{end}} item menu">
|
||||||
<a class="item" href="{{.RepoLink}}/issues">
|
<a class="item" href="{{.RepoLink}}/issues">
|
||||||
<i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui blue label">{{.Repository.NumOpenIssues}}</span>
|
<i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui blue label">{{.Repository.NumOpenIssues}}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -17,3 +18,4 @@
|
|||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
Loading…
Reference in New Issue
Block a user