Skip to content

Fix check for existence of New Branch button on Issue page

What does this MR do?

The condition in initCanCreateBranch mistakenly checks $container (the New Branch button) for falsy. However JQuery returns an empty array if no matching element was found, so this condition is never met.

Why was this MR needed?

The wrong condition causes:

  • $.getJSON($container.data('path')) to be called where $container.data('path') is undefined
  • in this case $.getJSON uses location.href
  • if the current page has a JSON representation, it is fetched and cached by browser and displayed the next time the page is visited (#17365 (closed))
  • otherwise "Failed to check if new branch can be created" is displayed (#17264 (closed))

What are the relevant issue numbers?

Fixes #17264 (closed) and #17365 (closed).

Merge request reports