Skip to content

Commit 443baeb

Browse files
authored
Merge pull request #14355 from cli/williammartin-clean-git-test-seams
Remove obsolete Git test seams
2 parents 30eb70c + 934db7e commit 443baeb

7 files changed

Lines changed: 1879 additions & 2037 deletions

File tree

‎git/client.go‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ type Client struct {
5858
Stdin io.Reader
5959
Stdout io.Writer
6060

61-
commandContext commandCtx
62-
mu sync.Mutex
61+
mu sync.Mutex
6362
}
6463

6564
func (c *Client) Copy() *Client {
@@ -70,19 +69,13 @@ func (c *Client) Copy() *Client {
7069
Stderr: c.Stderr,
7170
Stdin: c.Stdin,
7271
Stdout: c.Stdout,
73-
74-
commandContext: c.commandContext,
7572
}
7673
}
7774

7875
func (c *Client) Command(ctx context.Context, args ...string) (*Command, error) {
7976
if c.RepoDir != "" {
8077
args = append([]string{"-C", c.RepoDir}, args...)
8178
}
82-
commandContext := exec.CommandContext
83-
if c.commandContext != nil {
84-
commandContext = c.commandContext
85-
}
8679
var err error
8780
c.mu.Lock()
8881
if c.GitPath == "" {
@@ -92,7 +85,7 @@ func (c *Client) Command(ctx context.Context, args ...string) (*Command, error)
9285
if err != nil {
9386
return nil, err
9487
}
95-
cmd := commandContext(ctx, c.GitPath, args...)
88+
cmd := exec.CommandContext(ctx, c.GitPath, args...)
9689
cmd.Stderr = c.Stderr
9790
cmd.Stdin = c.Stdin
9891
cmd.Stdout = c.Stdout
@@ -644,6 +637,10 @@ func (c *Client) PushRevision(ctx context.Context, branch string) (RemoteTrackin
644637
return RemoteTrackingRef{}, err
645638
}
646639

640+
return parsePushRevision(revParseOut)
641+
}
642+
643+
func parsePushRevision(revParseOut []byte) (RemoteTrackingRef, error) {
647644
ref, err := ParseRemoteTrackingRef(firstLine(revParseOut))
648645
if err != nil {
649646
return RemoteTrackingRef{}, fmt.Errorf("could not parse push revision: %v", err)

0 commit comments

Comments
 (0)