diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-10-23 07:40:49 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-10-23 07:40:49 +0000 |
commit | 9b5685379efcb6ce43c8f8b38404152a8dc3ad9b (patch) | |
tree | 64ace80028b4aab5dd4e825e18e6791c2ae19d45 /app | |
parent | 66e02d395b42149b7fd0d96ca9aea1814f6eef28 (diff) | |
parent | 680afb3d77db2f90b1c79d3917ce5d2df187c68b (diff) | |
download | gitlab-ce-9b5685379efcb6ce43c8f8b38404152a8dc3ad9b.tar.gz |
Merge branch '42611-removed-branch-link' into 'master'
Resolve "Removed branch link in pipelines page is broken"
Closes #42611
See merge request gitlab-org/gitlab-ce!21451
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 10 | ||||
-rw-r--r-- | app/views/projects/pipelines/_info.html.haml | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 17024e8a0af..aeee7f0a5d2 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -268,6 +268,12 @@ module Ci stage unless stage.statuses_count.zero? end + def ref_exists? + project.repository.ref_exists?(git_ref) + rescue Gitlab::Git::Repository::NoRepository + false + end + ## # TODO We do not completely switch to persisted stages because of # race conditions with setting statuses gitlab-ce#23257. @@ -674,11 +680,11 @@ module Ci def push_details strong_memoize(:push_details) do - Gitlab::Git::Push.new(project, before_sha, sha, push_ref) + Gitlab::Git::Push.new(project, before_sha, sha, git_ref) end end - def push_ref + def git_ref if branch? Gitlab::Git::BRANCH_REF_PREFIX + ref.to_s elsif tag? diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml index dbb563f51ea..2575efc0981 100644 --- a/app/views/projects/pipelines/_info.html.haml +++ b/app/views/projects/pipelines/_info.html.haml @@ -13,7 +13,11 @@ = pluralize @pipeline.total_size, "job" - if @pipeline.ref from - = link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name" + - if @pipeline.ref_exists? + = link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name" + - else + %span.ref-name + = @pipeline.ref - if @pipeline.duration in = time_interval_in_words(@pipeline.duration) |