@@ -14,7 +14,6 @@ import (
14
14
"path"
15
15
"path/filepath"
16
16
"strconv"
17
- "strings"
18
17
"testing"
19
18
"time"
20
19
@@ -60,21 +59,6 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL {
60
59
return & u2
61
60
}
62
61
63
- func allowLFSFilters () []string {
64
- // Now here we should explicitly allow lfs filters to run
65
- filteredLFSGlobalArgs := make ([]string , len (git .GlobalCommandArgs ))
66
- j := 0
67
- for _ , arg := range git .GlobalCommandArgs {
68
- if strings .Contains (arg , "lfs" ) {
69
- j --
70
- } else {
71
- filteredLFSGlobalArgs [j ] = arg
72
- j ++
73
- }
74
- }
75
- return filteredLFSGlobalArgs [:j ]
76
- }
77
-
78
62
func onGiteaRunTB (t testing.TB , callback func (testing.TB , * url.URL ), prepare ... bool ) {
79
63
if len (prepare ) == 0 || prepare [0 ] {
80
64
defer prepareTestEnv (t , 1 )()
@@ -115,7 +99,7 @@ func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bo
115
99
116
100
func doGitClone (dstLocalPath string , u * url.URL ) func (* testing.T ) {
117
101
return func (t * testing.T ) {
118
- assert .NoError (t , git .CloneWithArgs (context .Background (), u .String (), dstLocalPath , allowLFSFilters (), git.CloneRepoOptions {}))
102
+ assert .NoError (t , git .CloneWithArgs (context .Background (), u .String (), dstLocalPath , git . AllowLFSFiltersArgs (), git.CloneRepoOptions {}))
119
103
exist , err := util .IsExist (filepath .Join (dstLocalPath , "README.md" ))
120
104
assert .NoError (t , err )
121
105
assert .True (t , exist )
@@ -124,7 +108,7 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
124
108
125
109
func doPartialGitClone (dstLocalPath string , u * url.URL ) func (* testing.T ) {
126
110
return func (t * testing.T ) {
127
- assert .NoError (t , git .CloneWithArgs (context .Background (), u .String (), dstLocalPath , allowLFSFilters (), git.CloneRepoOptions {
111
+ assert .NoError (t , git .CloneWithArgs (context .Background (), u .String (), dstLocalPath , git . AllowLFSFiltersArgs (), git.CloneRepoOptions {
128
112
Filter : "blob:none" ,
129
113
}))
130
114
exist , err := util .IsExist (filepath .Join (dstLocalPath , "README.md" ))
@@ -197,7 +181,7 @@ func doGitCreateBranch(dstPath, branch string) func(*testing.T) {
197
181
198
182
func doGitCheckoutBranch (dstPath string , args ... string ) func (* testing.T ) {
199
183
return func (t * testing.T ) {
200
- _ , err := git .NewCommandNoGlobals (append (append (allowLFSFilters (), "checkout" ), args ... )... ).RunInDir (dstPath )
184
+ _ , err := git .NewCommandNoGlobals (append (append (git . AllowLFSFiltersArgs (), "checkout" ), args ... )... ).RunInDir (dstPath )
201
185
assert .NoError (t , err )
202
186
}
203
187
}
@@ -211,7 +195,7 @@ func doGitMerge(dstPath string, args ...string) func(*testing.T) {
211
195
212
196
func doGitPull (dstPath string , args ... string ) func (* testing.T ) {
213
197
return func (t * testing.T ) {
214
- _ , err := git .NewCommandNoGlobals (append (append (allowLFSFilters (), "pull" ), args ... )... ).RunInDir (dstPath )
198
+ _ , err := git .NewCommandNoGlobals (append (append (git . AllowLFSFiltersArgs (), "pull" ), args ... )... ).RunInDir (dstPath )
215
199
assert .NoError (t , err )
216
200
}
217
201
}
0 commit comments