Applying suggested changes can result in an invalid commit message

Summary

When applying a suggested change, the commit message created could be longer than 72 characters. This will result in a failed pipeline job with the following error:

Errors:
- [ ] 8cba5f0c4121522c795fdf69f8f0cf123d79c5d2: The commit subject may not be longer than 72 characters

Steps to reproduce

As the commit message is created using the modified file's path, applying changes to a changelog, or any file with a long name could reproduce the error.

What is the current bug behaviour?

The commit message created by applying suggested changes will be longer than 72 characters if the modified file's path has 50 or more characters.

What is the expected correct behaviour?

The commit message generated by applying suggested changes should be valid.

Relevant logs and/or screenshots

suggestion

  • See generated commit
  • See failed job

Output of checks

This bug happens on GitLab.com

Possible fixes

Possibly modifying the way the message is created and making sure it's not longer than 72 characters.

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/services/suggestions/apply_service.rb#L52

Assignee Loading
Time tracking Loading