| 12 | } |
| 13 | |
| 14 | func ParseCommitish(commitish string) (*Commitish, error) { |
| 15 | if commitish == "" { |
| 16 | return nil, errors.New("empty pool and branch") |
| 17 | } |
| 18 | if strings.IndexByte(commitish, '\'') >= 0 { |
| 19 | return nil, errors.New("pool and branch names may not contain single quote characters") |
| 20 | } |
| 21 | if i := strings.LastIndexByte(commitish, '@'); i > -1 { |
| 22 | return &Commitish{Pool: commitish[:i], Branch: commitish[i+1:]}, nil |
| 23 | } |
| 24 | return &Commitish{Pool: commitish}, nil |
| 25 | } |
| 26 | |
| 27 | var ErrNoPool = errors.New("no pool") |
| 28 | |