@@ -14,7 +14,6 @@ import (
1414 "path"
1515 "path/filepath"
1616 "strconv"
17- "strings"
1817 "testing"
1918 "time"
2019
@@ -60,21 +59,6 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL {
6059 return & u2
6160}
6261
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-
7862func onGiteaRunTB (t testing.TB , callback func (testing.TB , * url.URL ), prepare ... bool ) {
7963 if len (prepare ) == 0 || prepare [0 ] {
8064 defer prepareTestEnv (t , 1 )()
@@ -115,7 +99,7 @@ func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bo
11599
116100func doGitClone (dstLocalPath string , u * url.URL ) func (* testing.T ) {
117101 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 {}))
119103 exist , err := util .IsExist (filepath .Join (dstLocalPath , "README.md" ))
120104 assert .NoError (t , err )
121105 assert .True (t , exist )
@@ -124,7 +108,7 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
124108
125109func doPartialGitClone (dstLocalPath string , u * url.URL ) func (* testing.T ) {
126110 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 {
128112 Filter : "blob:none" ,
129113 }))
130114 exist , err := util .IsExist (filepath .Join (dstLocalPath , "README.md" ))
@@ -197,7 +181,7 @@ func doGitCreateBranch(dstPath, branch string) func(*testing.T) {
197181
198182func doGitCheckoutBranch (dstPath string , args ... string ) func (* testing.T ) {
199183 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 )
201185 assert .NoError (t , err )
202186 }
203187}
@@ -211,7 +195,7 @@ func doGitMerge(dstPath string, args ...string) func(*testing.T) {
211195
212196func doGitPull (dstPath string , args ... string ) func (* testing.T ) {
213197 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 )
215199 assert .NoError (t , err )
216200 }
217201}
0 commit comments