Skip to content

Unable to load commit data on branch where the branch name contains a hash

Summary

When browsing to a branch in GitLab where the branch name contains a # character and error is displayed at the top of the page stating

An error occurred while fetching commit data.

The commit data usually displayed on the repository view also never loads:

image

Steps to reproduce

  1. in any project edit a file in the WebIDE
  2. click on Create Commit, select Create a new branch and enter a new branch name containing a hash (for example test-#-1)
  3. if Start a new merge request is selected the following error will be shown after clicking Commit: image
  4. if Start a new merge request is not selected the view stays on the Web IDE editor
  5. browse to Repository > Branches and click on the branch created by the above commit which contains the # character
  6. the above error about the commit data will be displayed

Example Project

I have reproduced this on https://gitlab.com/gitlab-gold/ahergenhan/ci-test-project

What is the current bug behavior?

Any branches that contain # in their names cannot load the commit data.

What is the expected correct behavior?

The commit data should load regardless of the characters used in the branch name

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes