mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Remove git.Command.Run and git.Command.RunInDir* (#19280)
				
					
				
			Follows #19266, #8553, Close #18553, now there are only three `Run..(&RunOpts{})` functions. * before: `stdout, err := RunInDir(path)` * now: `stdout, _, err := RunStdString(&git.RunOpts{Dir:path})`
This commit is contained in:
		@@ -19,7 +19,7 @@ func TestRunWithContextNoTimeout(t *testing.T) {
 | 
			
		||||
	// 'git --version' does not block so it must be finished before the timeout triggered.
 | 
			
		||||
	cmd := NewCommand(context.Background(), "--version")
 | 
			
		||||
	for i := 0; i < maxLoops; i++ {
 | 
			
		||||
		if err := cmd.RunWithContext(&RunContext{}); err != nil {
 | 
			
		||||
		if err := cmd.Run(&RunOpts{}); err != nil {
 | 
			
		||||
			t.Fatal(err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -31,7 +31,7 @@ func TestRunWithContextTimeout(t *testing.T) {
 | 
			
		||||
	// 'git hash-object --stdin' blocks on stdin so we can have the timeout triggered.
 | 
			
		||||
	cmd := NewCommand(context.Background(), "hash-object", "--stdin")
 | 
			
		||||
	for i := 0; i < maxLoops; i++ {
 | 
			
		||||
		if err := cmd.RunWithContext(&RunContext{Timeout: 1 * time.Millisecond}); err != nil {
 | 
			
		||||
		if err := cmd.Run(&RunOpts{Timeout: 1 * time.Millisecond}); err != nil {
 | 
			
		||||
			if err != context.DeadlineExceeded {
 | 
			
		||||
				t.Fatalf("Testing %d/%d: %v", i, maxLoops, err)
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user