mirror of
https://github.com/docker/compose.git
synced 2025-07-28 16:14:06 +02:00
forward git command error to user
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
6a2d16bd10
commit
d62e21025c
@ -133,12 +133,12 @@ func (g gitRemoteLoader) resolveGitRef(ctx context.Context, path string, ref *gi
|
|||||||
if !commitSHA.MatchString(ref.Commit) {
|
if !commitSHA.MatchString(ref.Commit) {
|
||||||
cmd := exec.CommandContext(ctx, "git", "ls-remote", "--exit-code", ref.Remote, ref.Commit)
|
cmd := exec.CommandContext(ctx, "git", "ls-remote", "--exit-code", ref.Remote, ref.Commit)
|
||||||
cmd.Env = g.gitCommandEnv()
|
cmd.Env = g.gitCommandEnv()
|
||||||
out, err := cmd.Output()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if cmd.ProcessState.ExitCode() == 2 {
|
if cmd.ProcessState.ExitCode() == 2 {
|
||||||
return fmt.Errorf("repository does not contain ref %s, output: %q: %w", path, string(out), err)
|
return fmt.Errorf("repository does not contain ref %s, output: %q: %w", path, string(out), err)
|
||||||
}
|
}
|
||||||
return err
|
return fmt.Errorf("failed to access repository at %s:\n %s", ref.Remote, out)
|
||||||
}
|
}
|
||||||
if len(out) < 40 {
|
if len(out) < 40 {
|
||||||
return fmt.Errorf("unexpected git command output: %q", string(out))
|
return fmt.Errorf("unexpected git command output: %q", string(out))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user