Skip to content

Commit 77967dc

Browse files
committed
Allow merge commits in stable branches
1 parent 650d243 commit 77967dc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

bin/prohibit-merge-commits.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
out, _err, status = Open3.capture3("git", "rev-list", "--parents", "#{oldrev}..#{newrev}")
77
if status.success?
88
out.lines.each do |s|
9-
if s.split.size >= 3
10-
STDERR.puts "A merge commit is prohibited."
9+
# Allow merge commits in stable branches to preserve history for stable releases
10+
if s.split.size >= 3 && !File.basename(refname).match?(/\Aruby_\d+_\d+\z/)
11+
STDERR.puts "A merge commit is prohibited for #{refname}."
1112
exit 1
1213
end
1314
end

0 commit comments

Comments
 (0)