@@ -3,8 +3,6 @@ package vcssyncer
3
3
import (
4
4
"bytes"
5
5
"context"
6
- "github.com/sourcegraph/sourcegraph/internal/gitserver/protocol"
7
- "github.com/sourcegraph/sourcegraph/internal/lazyregexp"
8
6
"io"
9
7
"os"
10
8
"os/exec"
@@ -13,12 +11,13 @@ import (
13
11
14
12
"github.com/sourcegraph/log"
15
13
16
- "github.com/sourcegraph/sourcegraph/internal/api"
17
-
18
14
"github.com/sourcegraph/sourcegraph/cmd/gitserver/internal/common"
19
15
"github.com/sourcegraph/sourcegraph/cmd/gitserver/internal/executil"
20
16
"github.com/sourcegraph/sourcegraph/cmd/gitserver/internal/git"
21
17
"github.com/sourcegraph/sourcegraph/cmd/gitserver/internal/urlredactor"
18
+ "github.com/sourcegraph/sourcegraph/internal/api"
19
+ "github.com/sourcegraph/sourcegraph/internal/gitserver/protocol"
20
+ "github.com/sourcegraph/sourcegraph/internal/lazyregexp"
22
21
"github.com/sourcegraph/sourcegraph/internal/wrexec"
23
22
"github.com/sourcegraph/sourcegraph/lib/errors"
24
23
)
@@ -63,33 +62,31 @@ func (s *gitRepoSyncer) IsCloneable(ctx context.Context, repoName api.RepoName)
63
62
return errors .Wrapf (err , "failed to get remote URL source for %s" , repoName )
64
63
}
65
64
66
- {
67
- remoteURL , err := source .RemoteURL (ctx )
68
- if err != nil {
69
- return errors .Wrapf (err , "failed to get remote URL for %s" , repoName )
70
- }
65
+ remoteURL , err := source .RemoteURL (ctx )
66
+ if err != nil {
67
+ return errors .Wrapf (err , "failed to get remote URL for %s" , repoName )
68
+ }
71
69
72
- args := []string {"ls-remote" , remoteURL .String (), "HEAD" }
73
- ctx , cancel := context .WithTimeout (ctx , 30 * time .Second )
74
- defer cancel ()
70
+ args := []string {"ls-remote" , remoteURL .String (), "HEAD" }
71
+ ctx , cancel := context .WithTimeout (ctx , 30 * time .Second )
72
+ defer cancel ()
75
73
76
- r := urlredactor .New (remoteURL )
77
- cmd := exec .CommandContext (ctx , "git" , args ... )
74
+ r := urlredactor .New (remoteURL )
75
+ cmd := exec .CommandContext (ctx , "git" , args ... )
78
76
79
- // Configure the command to be able to talk to a remote.
80
- executil .ConfigureRemoteGitCommand (cmd , remoteURL )
77
+ // Configure the command to be able to talk to a remote.
78
+ executil .ConfigureRemoteGitCommand (cmd , remoteURL )
81
79
82
- out , err := s .recordingCommandFactory .WrapWithRepoName (ctx , log .NoOp (), repoName , cmd ).WithRedactorFunc (r .Redact ).CombinedOutput ()
83
- if err != nil {
84
- if ctxerr := ctx .Err (); ctxerr != nil {
85
- err = ctxerr
86
- }
87
- if len (out ) > 0 {
88
- redactedOutput := urlredactor .New (remoteURL ).Redact (string (out ))
89
- err = errors .Wrap (err , "failed to check remote access: " + redactedOutput )
90
- }
91
- return err
80
+ out , err := s .recordingCommandFactory .WrapWithRepoName (ctx , log .NoOp (), repoName , cmd ).WithRedactorFunc (r .Redact ).CombinedOutput ()
81
+ if err != nil {
82
+ if ctxerr := ctx .Err (); ctxerr != nil {
83
+ err = ctxerr
84
+ }
85
+ if len (out ) > 0 {
86
+ redactedOutput := r .Redact (string (out ))
87
+ err = errors .Wrap (err , "failed to check remote access: " + redactedOutput )
92
88
}
89
+ return err
93
90
}
94
91
95
92
return nil
0 commit comments