diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-06 15:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-06 15:10:04 +0300 |
commit | 53fb4ad16325d4963fdc5396b8510ab748a45e50 (patch) | |
tree | b1bd9ce5cbff5bf9c94f60fee3db86d3d53ffadc /app/assets/javascripts/projects | |
parent | f57ca9a5fc582232e23b2495812d57bf6f64313b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/projects')
-rw-r--r-- | app/assets/javascripts/projects/commits/index.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/app/assets/javascripts/projects/commits/index.js b/app/assets/javascripts/projects/commits/index.js index 53169f689c9..f56884f605f 100644 --- a/app/assets/javascripts/projects/commits/index.js +++ b/app/assets/javascripts/projects/commits/index.js @@ -33,20 +33,31 @@ export const initCommitsRefSwitcher = () => { if (!el) return false; - const { projectId, ref, commitsPath } = el.dataset; + const { projectId, ref, commitsPath, refType } = el.dataset; const commitsPathPrefix = commitsPath.match(COMMITS_PATH_REGEX)?.[0]; - + const useSymbolicRefNames = Boolean(refType); return new Vue({ el, render(createElement) { return createElement(RefSelector, { props: { projectId, - value: ref, + value: useSymbolicRefNames ? `refs/${refType}/${ref}` : ref, + useSymbolicRefNames, + refType, }, on: { input(selected) { - visitUrl(`${commitsPathPrefix}/${selected}`); + if (useSymbolicRefNames) { + const matches = selected.match(/refs\/(heads|tags)\/(.+)/); + if (matches) { + visitUrl(`${commitsPathPrefix}/${matches[2]}?ref_type=${matches[1]}`); + } else { + visitUrl(`${commitsPathPrefix}/${selected}`); + } + } else { + visitUrl(`${commitsPathPrefix}/${selected}`); + } }, }, }); |