summaryrefslogtreecommitdiff
path: root/app/controllers/projects/tree_controller.rb
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-03-30 21:08:43 +0000
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-03-30 21:08:43 +0000
commit125e519c15ece1361000fcdb8379cb40329b33fd (patch)
tree78253d9abc4a68b07c0013e4d8448f0104cd199d /app/controllers/projects/tree_controller.rb
parentb405157ce7809b3671155faa8f3c3395e3fc74ce (diff)
parentd6192c2ab77ab814b9bd66103663047556fd67e4 (diff)
downloadgitlab-ce-125e519c15ece1361000fcdb8379cb40329b33fd.tar.gz
Merge remote-tracking branch 'dev/15-9-stable' into 15-9-stable
Diffstat (limited to 'app/controllers/projects/tree_controller.rb')
-rw-r--r--app/controllers/projects/tree_controller.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index 737a6290431..1f7912e15df 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -28,6 +28,15 @@ class Projects::TreeController < Projects::ApplicationController
def show
return render_404 unless @commit
+ @ref_type = ref_type
+ if @ref_type == BRANCH_REF_TYPE && ambiguous_ref?(@project, @ref)
+ branch = @project.repository.find_branch(@ref)
+ if branch
+ redirect_to project_tree_path(@project, branch.target)
+ return
+ end
+ end
+
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
redirect_to project_blob_path(@project, File.join(@ref, @path))