summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipeline_new/utils/format_refs.js
blob: f0fbc5ed7b6e577853cca2935ac4543cec39a9f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '../constants';

export default (refs, type) => {
  let fullName;

  return refs.map((ref) => {
    if (type === BRANCH_REF_TYPE) {
      fullName = `refs/heads/${ref}`;
    } else if (type === TAG_REF_TYPE) {
      fullName = `refs/tags/${ref}`;
    }

    return {
      shortName: ref,
      fullName,
    };
  });
};