(stderr *bytes.Buffer)
| 734 | } |
| 735 | |
| 736 | func parseDiffStderr(stderr *bytes.Buffer) error { |
| 737 | errRaw := stderr.String() // assume there will never be a lot of output to stdout |
| 738 | if len(errRaw) == 0 { |
| 739 | return nil |
| 740 | } |
| 741 | |
| 742 | if idx := strings.IndexByte(errRaw, '\n'); idx > 0 { |
| 743 | errRaw = errRaw[:idx] // get only the first line of the output |
| 744 | } |
| 745 | |
| 746 | errRaw = strings.TrimPrefix(errRaw, "fatal: ") // git errors start with the "fatal: " prefix |
| 747 | |
| 748 | if strings.Contains(errRaw, "bad revision") { |
| 749 | return parser.ErrSHADoesNotMatch |
| 750 | } |
| 751 | |
| 752 | return errors.New(errRaw) |
| 753 | } |
no test coverage detected
searching dependent graphs…