mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 05:01:47 +02:00
Fix push multiple branches error with tests (#31151)
(cherry picked from commit 5c1b550e00e9460078e00c41a32d206b260ef482) Conflicts: tests/integration/git_push_test.go trivial context conflict because of2ac3dcbd43
test: hook post-receive for sha256 repos (cherry picked from commit62448bfb93
) (cherry picked from commit e8c776c79384c1c0a4d707ce5084b27347703848)
This commit is contained in:
parent
4d0a5ea317
commit
d462b6d495
3 changed files with 54 additions and 1 deletions
|
@ -51,6 +51,41 @@ func testGitPush(t *testing.T, u *url.URL) {
|
|||
})
|
||||
})
|
||||
|
||||
t.Run("Push branches exists", func(t *testing.T) {
|
||||
runTestGitPush(t, u, objectFormat, func(t *testing.T, gitPath string) (pushed, deleted []string) {
|
||||
for i := 0; i < 10; i++ {
|
||||
branchName := fmt.Sprintf("branch-%d", i)
|
||||
if i < 5 {
|
||||
pushed = append(pushed, branchName)
|
||||
}
|
||||
doGitCreateBranch(gitPath, branchName)(t)
|
||||
}
|
||||
// only push master and the first 5 branches
|
||||
pushed = append(pushed, "master")
|
||||
args := append([]string{"origin"}, pushed...)
|
||||
doGitPushTestRepository(gitPath, args...)(t)
|
||||
|
||||
pushed = pushed[:0]
|
||||
// do some changes for the first 5 branches created above
|
||||
for i := 0; i < 5; i++ {
|
||||
branchName := fmt.Sprintf("branch-%d", i)
|
||||
pushed = append(pushed, branchName)
|
||||
|
||||
doGitAddSomeCommits(gitPath, branchName)(t)
|
||||
}
|
||||
|
||||
for i := 5; i < 10; i++ {
|
||||
pushed = append(pushed, fmt.Sprintf("branch-%d", i))
|
||||
}
|
||||
pushed = append(pushed, "master")
|
||||
|
||||
// push all, so that master are not chagned
|
||||
doGitPushTestRepository(gitPath, "origin", "--all")(t)
|
||||
|
||||
return pushed, deleted
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Push branches one by one", func(t *testing.T) {
|
||||
runTestGitPush(t, u, objectFormat, func(t *testing.T, gitPath string) (pushed, deleted []string) {
|
||||
for i := 0; i < 100; i++ {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue