Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !7382

Merged
Created Jul 27, 2014 by Administrator@rootOwner1 of 1 task completed1/1 task

Validate branch/tag-names and references WebUI, API

  • Overview 39
  • Commits 2
  • Changes 19

Created by: Razer6

What does this MR do?

This PR adds validation for invalid input for branch and tag names. Validating a name is done using the git subcommand git check-ref-format. If an error occurs, an error message is shown indicating a wrong input.

This behavior is also added to the API. If an error occurs a 405 error responded.

Why was this MR needed?

Currently when entering an invalid name for branch or invalid reference name GitLab fails silently or raises a 500 error. This behavior also applies if the branch already exists.

What are the relevant issue numbers / Feature requests?

This PR fixes:

  • #7381 (closed)
  • #6805 (closed)
  • https://gitlab.com/gitlab-org/gitlab-ce/issues/238
  • https://gitlab.com/gitlab-org/gitlab-ce/issues/436
  • https://gitlab.com/gitlab-org/gitlab-ce/issues/406
  • http://feedback.gitlab.com/forums/176466-general/suggestions/6171376-fix-error-500-when-create-branch
  • http://feedback.gitlab.com/forums/176466-general/suggestions/6201425-validate-branch-name-uniqueness-on-web-ui-creation

TODO

  • Add support for tag validation

Many thanks to @jvanbaarsen for his help for a ruby beginner.

@randx Creating a new branch within the spinach test doesn't work. The current testcases passes because the branch already exists in the test repository. @jvanbaarsen also looked at this problem, but doesn't know what's going on here.

Something similar happens on specs. Since there is now an explicit return value when creating a new branch, this fails and returns an error. Have you any thoughts why creating a branch doesn't work within the testsuite?

/cc @cirosantilli

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/Razer6/git_ref_validation