summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects/compare_controller.rb3
-rw-r--r--app/views/projects/commits/_head.html.haml2
2 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb
index 7c20b81c0b1..c5f085c236f 100644
--- a/app/controllers/projects/compare_controller.rb
+++ b/app/controllers/projects/compare_controller.rb
@@ -6,11 +6,12 @@ class Projects::CompareController < Projects::ApplicationController
before_action :authorize_download_code!
def index
+ @ref = Addressable::URI.unescape(params[:to])
end
def show
base_ref = Addressable::URI.unescape(params[:from])
- head_ref = Addressable::URI.unescape(params[:to])
+ @ref = head_ref = Addressable::URI.unescape(params[:to])
compare_result = CompareService.new.execute(
current_user,
diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml
index a714f5f79e0..66101f3f0da 100644
--- a/app/views/projects/commits/_head.html.haml
+++ b/app/views/projects/commits/_head.html.haml
@@ -1,6 +1,6 @@
%ul.nav.nav-tabs
= nav_link(controller: [:commit, :commits]) do
- = link_to namespace_project_commits_path(@project.namespace, @project, @repository.root_ref) do
+ = link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do
Commits
%span.badge= number_with_precision(@repository.commit_count, precision: 0, delimiter: ',')
= nav_link(controller: :compare) do