Skip to content

Commit b68b5ee

Browse files
committed
redirect stdout of git command to stderr to avoid protocol issues
- stdout should be used only for git remote helper protocol
1 parent e003bf7 commit b68b5ee

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

cmd/git-remote-gitopia/gitopia.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,31 @@ func (h *GitopiaHandler) Initialize(remote *core.Remote) error {
5858
// Check existing configuration
5959
grpcHost, _ := config.GitConfigGet(config.GitopiaConfigGRPCHostOption)
6060
tmAddr, _ := config.GitConfigGet(config.GitopiaConfigTmAddrOption)
61-
61+
6262
// Validate and configure gRPC and RPC hosts
6363
needsReconfiguration := false
6464
if grpcHost == "" || tmAddr == "" || !api.CheckGRPCHostLiveness(grpcHost) || !api.CheckRPCHostLiveness(tmAddr) {
6565
needsReconfiguration = true
6666
}
67-
67+
6868
if needsReconfiguration {
6969
remote.Logger.Printf("Configuring Gitopia hosts...")
7070
provider := api.GetBestApiProvider()
7171
grpcHost = provider.GRPCHost
7272
tmAddr = provider.TMAddr
73-
73+
7474
if err := api.SetConfiguredGRPCHost(provider.GRPCHost); err != nil {
7575
return err
7676
}
77-
77+
7878
if err := api.SetConfiguredTmAddr(provider.TMAddr); err != nil {
7979
return err
8080
}
8181
}
8282

8383
// Check and configure Git server host
8484
gitServerHost, _ := config.GitConfigGet(config.GitopiaConfigGitServerHostOption)
85-
85+
8686
if gitServerHost == "" || !api.CheckGitServerHostLiveness(gitServerHost) {
8787
gitServerHost = api.GetBestGitServerHost(grpcHost)
8888
if gitServerHost != "" {

core/util.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ func GetLocalDir() (string, error) {
3232
func GitCommand(name string, args ...string) *exec.Cmd {
3333
cmd := exec.Command(name, args...)
3434
cmd.Env = os.Environ()
35-
cmd.Stdout = os.Stdout
35+
// Redirect stdout to stderr to avoid protocol communication issues
36+
cmd.Stdout = os.Stderr
3637
cmd.Stderr = os.Stderr
3738

3839
return cmd

0 commit comments

Comments
 (0)