diff options
author | 6543 <6543@obermui.de> | 2022-01-20 18:46:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 18:46:10 +0100 |
commit | 54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch) | |
tree | 1be12fb072625c1b896b9d72f7912b018aad502b /integrations/git_test.go | |
parent | 1d98d205f5825f40110e6628b61a97c91ac7f72d (diff) | |
download | gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.tar.gz gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.zip |
format with gofumpt (#18184)
* gofumpt -w -l .
* gofumpt -w -l -extra .
* Add linter
* manual fix
* change make fmt
Diffstat (limited to 'integrations/git_test.go')
-rw-r--r-- | integrations/git_test.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go index 0d33c786aa..243cca2e55 100644 --- a/integrations/git_test.go +++ b/integrations/git_test.go @@ -32,8 +32,8 @@ import ( ) const ( - littleSize = 1024 //1ko - bigSize = 128 * 1024 * 1024 //128Mo + littleSize = 1024 // 1ko + bigSize = 128 * 1024 * 1024 // 128Mo ) func TestGit(t *testing.T) { @@ -96,15 +96,15 @@ func testGit(t *testing.T, u *url.URL) { t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, sshContext.Username, perm.AccessModeRead)) t.Run("ForkFromDifferentUser", doAPIForkRepository(sshContext, forkedUserCtx.Username)) - //Setup key the user ssh key + // Setup key the user ssh key withKeyFile(t, keyname, func(keyFile string) { t.Run("CreateUserKey", doAPICreateUserKey(sshContext, "test-key", keyFile)) - //Setup remote link - //TODO: get url from api + // Setup remote link + // TODO: get url from api sshURL := createSSHUrl(sshContext.GitPath(), u) - //Setup clone folder + // Setup clone folder dstPath, err := os.MkdirTemp("", sshContext.Reponame) assert.NoError(t, err) defer util.RemoveAll(dstPath) @@ -135,7 +135,6 @@ func ensureAnonymousClone(t *testing.T, u *url.URL) { assert.NoError(t, err) defer util.RemoveAll(dstLocalPath) t.Run("CloneAnonymous", doGitClone(dstLocalPath, u)) - } func standardCommitAndPushTest(t *testing.T, dstPath string) (little, big string) { @@ -300,13 +299,13 @@ func lockFileTest(t *testing.T, filename, repoPath string) { func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string { name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix) assert.NoError(t, err) - _, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) //Push + _, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) // Push assert.NoError(t, err) return name } func generateCommitWithNewData(size int, repoPath, email, fullName, prefix string) (string, error) { - //Generate random file + // Generate random file bufSize := 4 * 1024 if bufSize > size { bufSize = size @@ -339,7 +338,7 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin return "", err } - //Commit + // Commit // Now here we should explicitly allow lfs filters to run globalArgs := allowLFSFilters() err = git.AddChangesWithArgs(repoPath, globalArgs, false, filepath.Base(tmpFile.Name())) @@ -639,7 +638,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB t.Run("CreateHeadBranch", doGitCreateBranch(dstPath, headBranch)) t.Run("AddCommit", func(t *testing.T) { - err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0666) + err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0o666) if !assert.NoError(t, err) { return } @@ -713,7 +712,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB } t.Run("AddCommit2", func(t *testing.T) { - err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0666) + err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0o666) if !assert.NoError(t, err) { return } |