1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-10-15 19:42:04 +00:00

chore: unbreak existing tests

Because the user:password is no longer automatically set as upstream
origin, we have to set it manually if we want push to work.
This commit is contained in:
Gusted 2025-08-24 02:44:22 +02:00 committed by Earl Warren
parent 9fb75a141d
commit f7fb1226a4
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 16 additions and 0 deletions

View file

@ -105,6 +105,8 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md"))
require.NoError(t, err)
assert.True(t, exist)
// Set user:password
doGitSetRemoteURL(dstLocalPath, "origin", u)(t)
}
}
@ -117,6 +119,8 @@ func doPartialGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md"))
require.NoError(t, err)
assert.True(t, exist)
// Set user:password
doGitSetRemoteURL(dstLocalPath, "origin", u)(t)
}
}
@ -162,6 +166,14 @@ func doGitAddRemote(dstPath, remoteName string, u *url.URL) func(*testing.T) {
}
}
func doGitSetRemoteURL(dstPath, remoteName string, u *url.URL) func(*testing.T) {
return func(t *testing.T) {
t.Helper()
_, _, err := git.NewCommand(git.DefaultContext, "remote", "set-url").AddDynamicArguments(remoteName, u.String()).RunStdString(&git.RunOpts{Dir: dstPath})
require.NoError(t, err)
}
}
func doGitPushTestRepository(dstPath string, args ...string) func(*testing.T) {
return func(t *testing.T) {
t.Helper()