mirror of
https://github.com/go-gitea/gitea
synced 2025-07-14 22:47:21 +00:00
Fix push multiple branches error with tests (#31151)
This commit is contained in:
@ -160,6 +160,24 @@ func doGitPushTestRepositoryFail(dstPath string, args ...string) func(*testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func doGitAddSomeCommits(dstPath, branch string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
doGitCheckoutBranch(dstPath, branch)(t)
|
||||
|
||||
assert.NoError(t, os.WriteFile(filepath.Join(dstPath, fmt.Sprintf("file-%s.txt", branch)), []byte(fmt.Sprintf("file %s", branch)), 0o644))
|
||||
assert.NoError(t, git.AddChanges(dstPath, true))
|
||||
signature := git.Signature{
|
||||
Email: "test@test.test",
|
||||
Name: "test",
|
||||
}
|
||||
assert.NoError(t, git.CommitChanges(dstPath, git.CommitChangesOptions{
|
||||
Committer: &signature,
|
||||
Author: &signature,
|
||||
Message: fmt.Sprintf("update %s", branch),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
func doGitCreateBranch(dstPath, branch string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
_, _, err := git.NewCommand(git.DefaultContext, "checkout", "-b").AddDynamicArguments(branch).RunStdString(&git.RunOpts{Dir: dstPath})
|
||||
|
Reference in New Issue
Block a user