Commit fbc6f95a authored by Marin Jankovski's avatar Marin Jankovski

Protect default branch by default.

parent 2ebd2d41
...@@ -3,6 +3,7 @@ v 7.4.0 ...@@ -3,6 +3,7 @@ v 7.4.0
- Fix creating new files with web editor - Fix creating new files with web editor
- Improve error reporting on users API (Julien Bianchi) - Improve error reporting on users API (Julien Bianchi)
- Refactor test coverage tools usage. Use SIMPLECOV=true to generate it locally - Refactor test coverage tools usage. Use SIMPLECOV=true to generate it locally
- Default branch is protected by default
- Increase unicorn timeout to 60 seconds - Increase unicorn timeout to 60 seconds
- Sort search autocomplete projects by stars count so most popular go first - Sort search autocomplete projects by stars count so most popular go first
......
...@@ -29,6 +29,8 @@ class GitPushService ...@@ -29,6 +29,8 @@ class GitPushService
if is_default_branch?(ref) if is_default_branch?(ref)
# Initial push to the default branch. Take the full history of that branch as "newly pushed". # Initial push to the default branch. Take the full history of that branch as "newly pushed".
@push_commits = project.repository.commits(newrev) @push_commits = project.repository.commits(newrev)
# Default branch is protected by default
project.protected_branches.create({ name: project.default_branch })
else else
# Use the pushed commits that aren't reachable by the default branch # Use the pushed commits that aren't reachable by the default branch
# as a heuristic. This may include more commits than are actually pushed, but # as a heuristic. This may include more commits than are actually pushed, but
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment