Searching for commits in the repository commits page fails when trailing spaces exist
Summary
When you paste a commit title, sometimes trailing spaces can be included.
The query is affected by this invisible character and will return empty.
This increases in change, because when you copy the heading on the Commit details page, it's easy to include a space.
Steps to reproduce
- Go to a commit page of a commit in default branch.
- Copy the title of the commit.
- Go to the repository commits page of default branch.
- Paste the commit title into the search box.
- See that no results are returned.
- Delete the trailing space.
- See the commit being shown.
Example Project
gitlab-org/gitlab, any really.
What is the current bug behavior?
Search returns empty.
What is the expected correct behavior?
Search returns the desired commit.
Relevant logs and/or screenshots
Copying the heading in commits page
Searching for it
Expected (without trailing space)
Possible fixes
Some options:
- Trim the query string, to avoid trailing and leading spaces?
and/or
- Add an easy way to copy the title of the commit in the Commits page (copy to clipboard?)
- Or even a button to "Is this commit on branch: [________]"
Edited by André Luís