@ -63,7 +63,6 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL {
func allowLFSFilters ( ) [ ] string {
func allowLFSFilters ( ) [ ] string {
// Now here we should explicitly allow lfs filters to run
// Now here we should explicitly allow lfs filters to run
globalArgs := git . GlobalCommandArgs
filteredLFSGlobalArgs := make ( [ ] string , len ( git . GlobalCommandArgs ) )
filteredLFSGlobalArgs := make ( [ ] string , len ( git . GlobalCommandArgs ) )
j := 0
j := 0
for _ , arg := range git . GlobalCommandArgs {
for _ , arg := range git . GlobalCommandArgs {
@ -74,9 +73,7 @@ func allowLFSFilters() []string {
j ++
j ++
}
}
}
}
filteredLFSGlobalArgs = filteredLFSGlobalArgs [ : j ]
return filteredLFSGlobalArgs [ : j ]
git . GlobalCommandArgs = filteredLFSGlobalArgs
return globalArgs
}
}
func onGiteaRun ( t * testing . T , callback func ( * testing . T , * url . URL ) , prepare ... bool ) {
func onGiteaRun ( t * testing . T , callback func ( * testing . T , * url . URL ) , prepare ... bool ) {
@ -107,9 +104,7 @@ func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bo
func doGitClone ( dstLocalPath string , u * url . URL ) func ( * testing . T ) {
func doGitClone ( dstLocalPath string , u * url . URL ) func ( * testing . T ) {
return func ( t * testing . T ) {
return func ( t * testing . T ) {
oldGlobals := allowLFSFilters ( )
assert . NoError ( t , git . CloneWithArgs ( u . String ( ) , dstLocalPath , allowLFSFilters ( ) , git . CloneRepoOptions { } ) )
assert . NoError ( t , git . Clone ( u . String ( ) , dstLocalPath , git . CloneRepoOptions { } ) )
git . GlobalCommandArgs = oldGlobals
assert . True ( t , com . IsExist ( filepath . Join ( dstLocalPath , "README.md" ) ) )
assert . True ( t , com . IsExist ( filepath . Join ( dstLocalPath , "README.md" ) ) )
}
}
}
}
@ -170,9 +165,7 @@ func doGitCreateBranch(dstPath, branch string) func(*testing.T) {
func doGitCheckoutBranch ( dstPath string , args ... string ) func ( * testing . T ) {
func doGitCheckoutBranch ( dstPath string , args ... string ) func ( * testing . T ) {
return func ( t * testing . T ) {
return func ( t * testing . T ) {
oldGlobals := allowLFSFilters ( )
_ , err := git . NewCommandNoGlobals ( append ( append ( allowLFSFilters ( ) , "checkout" ) , args ... ) ... ) . RunInDir ( dstPath )
_ , err := git . NewCommand ( append ( [ ] string { "checkout" } , args ... ) ... ) . RunInDir ( dstPath )
git . GlobalCommandArgs = oldGlobals
assert . NoError ( t , err )
assert . NoError ( t , err )
}
}
}
}
@ -186,9 +179,7 @@ func doGitMerge(dstPath string, args ...string) func(*testing.T) {
func doGitPull ( dstPath string , args ... string ) func ( * testing . T ) {
func doGitPull ( dstPath string , args ... string ) func ( * testing . T ) {
return func ( t * testing . T ) {
return func ( t * testing . T ) {
oldGlobals := allowLFSFilters ( )
_ , err := git . NewCommandNoGlobals ( append ( append ( allowLFSFilters ( ) , "pull" ) , args ... ) ... ) . RunInDir ( dstPath )
_ , err := git . NewCommand ( append ( [ ] string { "pull" } , args ... ) ... ) . RunInDir ( dstPath )
git . GlobalCommandArgs = oldGlobals
assert . NoError ( t , err )
assert . NoError ( t , err )
}
}
}
}