aboutsummaryrefslogtreecommitdiffstats
path: root/tests/integration/git_push_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-05-29 14:43:02 +0800
committerGitHub <noreply@github.com>2024-05-29 06:43:02 +0000
commit5c1b550e00e9460078e00c41a32d206b260ef482 (patch)
tree3edac918be0dfb424233c80c9b5e5c1008d6754d /tests/integration/git_push_test.go
parent7034efc7dc0e355c63b11f0f633216d489d254be (diff)
downloadgitea-5c1b550e00e9460078e00c41a32d206b260ef482.tar.gz
gitea-5c1b550e00e9460078e00c41a32d206b260ef482.zip
Fix push multiple branches error with tests (#31151)
Diffstat (limited to 'tests/integration/git_push_test.go')
-rw-r--r--tests/integration/git_push_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/integration/git_push_test.go b/tests/integration/git_push_test.go
index b37fb02444..da254fc88f 100644
--- a/tests/integration/git_push_test.go
+++ b/tests/integration/git_push_test.go
@@ -37,6 +37,41 @@ func testGitPush(t *testing.T, u *url.URL) {
})
})
+ t.Run("Push branches exists", func(t *testing.T) {
+ runTestGitPush(t, u, 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, func(t *testing.T, gitPath string) (pushed, deleted []string) {
for i := 0; i < 100; i++ {