@@ -160,9 +160,9 @@ func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS strin
160
160
return
161
161
}
162
162
prefix := "lfs-data-file-"
163
- _ , err := git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("install" ).RunInDir ( dstPath )
163
+ err := git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("install" ).Run ( & git. RunOpts { Dir : dstPath } )
164
164
assert .NoError (t , err )
165
- _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("track" , prefix + "*" ).RunInDir ( dstPath )
165
+ _ , _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("track" , prefix + "*" ).RunStdString ( & git. RunOpts { Dir : dstPath } )
166
166
assert .NoError (t , err )
167
167
err = git .AddChanges (dstPath , false , ".gitattributes" )
168
168
assert .NoError (t , err )
@@ -292,20 +292,20 @@ func lockTest(t *testing.T, repoPath string) {
292
292
}
293
293
294
294
func lockFileTest (t * testing.T , filename , repoPath string ) {
295
- _ , err := git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("locks" ).RunInDir ( repoPath )
295
+ _ , _ , err := git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("locks" ).RunStdString ( & git. RunOpts { Dir : repoPath } )
296
296
assert .NoError (t , err )
297
- _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("lock" , filename ).RunInDir ( repoPath )
297
+ _ , _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("lock" , filename ).RunStdString ( & git. RunOpts { Dir : repoPath } )
298
298
assert .NoError (t , err )
299
- _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("locks" ).RunInDir ( repoPath )
299
+ _ , _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("locks" ).RunStdString ( & git. RunOpts { Dir : repoPath } )
300
300
assert .NoError (t , err )
301
- _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("unlock" , filename ).RunInDir ( repoPath )
301
+ _ , _ , err = git .NewCommand (git .DefaultContext , "lfs" ).AddArguments ("unlock" , filename ).RunStdString ( & git. RunOpts { Dir : repoPath } )
302
302
assert .NoError (t , err )
303
303
}
304
304
305
305
func doCommitAndPush (t * testing.T , size int , repoPath , prefix string ) string {
306
306
name ,
err := generateCommitWithNewData (
size ,
repoPath ,
"[email protected] " ,
"User Two" ,
prefix )
307
307
assert .NoError (t , err )
308
- _ , err = git .NewCommand (git .DefaultContext , "push" , "origin" , "master" ).RunInDir ( repoPath ) // Push
308
+ _ , _ , err = git .NewCommand (git .DefaultContext , "push" , "origin" , "master" ).RunStdString ( & git. RunOpts { Dir : repoPath } ) // Push
309
309
assert .NoError (t , err )
310
310
return name
311
311
}
@@ -671,7 +671,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
671
671
})
672
672
673
673
t .Run ("Push" , func (t * testing.T ) {
674
- _ , err := git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master" , "-o" , "topic=" + headBranch ).RunInDir ( dstPath )
674
+ err := git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master" , "-o" , "topic=" + headBranch ).Run ( & git. RunOpts { Dir : dstPath } )
675
675
if ! assert .NoError (t , err ) {
676
676
return
677
677
}
@@ -692,7 +692,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
692
692
assert .Contains (t , "Testing commit 1" , prMsg .Body )
693
693
assert .Equal (t , commit , prMsg .Head .Sha )
694
694
695
- _ , err = git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master/test/" + headBranch ).RunInDir ( dstPath )
695
+ _ , _ , err = git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master/test/" + headBranch ).RunStdString ( & git. RunOpts { Dir : dstPath } )
696
696
if ! assert .NoError (t , err ) {
697
697
return
698
698
}
@@ -745,7 +745,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
745
745
})
746
746
747
747
t .Run ("Push2" , func (t * testing.T ) {
748
- _ , err := git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master" , "-o" , "topic=" + headBranch ).RunInDir ( dstPath )
748
+ err := git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master" , "-o" , "topic=" + headBranch ).Run ( & git. RunOpts { Dir : dstPath } )
749
749
if ! assert .NoError (t , err ) {
750
750
return
751
751
}
@@ -757,7 +757,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
757
757
assert .Equal (t , false , prMsg .HasMerged )
758
758
assert .Equal (t , commit , prMsg .Head .Sha )
759
759
760
- _ , err = git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master/test/" + headBranch ).RunInDir ( dstPath )
760
+ _ , _ , err = git .NewCommand (git .DefaultContext , "push" , "origin" , "HEAD:refs/for/master/test/" + headBranch ).RunStdString ( & git. RunOpts { Dir : dstPath } )
761
761
if ! assert .NoError (t , err ) {
762
762
return
763
763
}
0 commit comments