| 339 | } |
| 340 | |
| 341 | func ResolveRef(ref string) (*Ref, error) { |
| 342 | outp, err := gitNoLFSSimple("rev-parse", ref, "--symbolic-full-name", ref) |
| 343 | if err != nil { |
| 344 | return nil, errors.New(tr.Tr.Get("Git can't resolve ref: %q", ref)) |
| 345 | } |
| 346 | if outp == "" { |
| 347 | return nil, errors.New(tr.Tr.Get("Git can't resolve ref: %q", ref)) |
| 348 | } |
| 349 | |
| 350 | lines := strings.Split(outp, "\n") |
| 351 | fullref := &Ref{Sha: lines[0]} |
| 352 | |
| 353 | if len(lines) == 1 { |
| 354 | // ref is a sha1 and has no symbolic-full-name |
| 355 | fullref.Name = lines[0] |
| 356 | fullref.Sha = lines[0] |
| 357 | fullref.Type = RefTypeOther |
| 358 | return fullref, nil |
| 359 | } |
| 360 | |
| 361 | // parse the symbolic-full-name |
| 362 | fullref.Type, fullref.Name = ParseRefToTypeAndName(lines[1]) |
| 363 | return fullref, nil |
| 364 | } |
| 365 | |
| 366 | func ResolveRefs(refnames []string) ([]*Ref, error) { |
| 367 | refs := make([]*Ref, len(refnames)) |