This commit is contained in:
wxiaoguang 2025-06-22 03:00:59 +08:00
parent dad9e4a00a
commit 713ab7cab4
2 changed files with 7 additions and 3 deletions

View File

@ -152,7 +152,7 @@ func prepareEditorCommitSubmittedForm[T forms.CommitCommonFormInterface](ctx *co
ctx.JSONError(ctx.Tr("repo.editor.fork_failed_to_push_branch", targetBranchName))
return nil
}
// since we have pushed the branch from base branch, so now we need to commit the changes directly
// we have pushed the base branch as the new branch, now we need to commit the changes directly to the new branch
oldBranchName = targetBranchName
}

View File

@ -407,7 +407,7 @@ func testForkToEditFile(t *testing.T, session *TestSession, user, owner, repo, b
assert.NotEmpty(t, lastCommit)
// change a file in the forked repo
req = NewRequestWithValues(t, "POST", formAction,
req = NewRequestWithValues(t, "POST", fmt.Sprintf("/%s/%s-1/_edit/%s/%s?from_base_branch=%s", user, repo, branch, filePath, branch),
map[string]string{
"_csrf": GetUserCSRFToken(t, session),
"last_commit": lastCommit,
@ -418,7 +418,11 @@ func testForkToEditFile(t *testing.T, session *TestSession, user, owner, repo, b
},
)
resp = session.MakeRequest(t, req, http.StatusOK)
assert.Equal(t, fmt.Sprintf("/%s/%s/compare/%s...%s/%s-1:%s-patch-1", owner, repo, branch, user, repo, user), test.RedirectURL(resp))
assert.Equal(t, fmt.Sprintf("/%s/%s/compare/%s...%s/%s-1:%s", owner, repo, branch, user, repo, newBranchName), test.RedirectURL(resp))
req = NewRequest(t, "GET", fmt.Sprintf("/%s/%s-1/src/branch/%s/%s", user, repo, newBranchName, filePath))
resp = session.MakeRequest(t, req, http.StatusOK)
assert.Contains(t, resp.Body.String(), "new content in fork")
}
func TestForkToEditFile(t *testing.T) {