Skip to content

Commit 16ff76a

Browse files
committed
refine regexp literal
1 parent 1ea2422 commit 16ff76a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git-prune-remote-branch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ opts.parse!
77

88
`git branch -r`.each_line do |branch|
99
branch.strip!.chomp!
10-
next if branch =~ /[^\/]+\/master/
11-
next if branch =~ /[^\/]+\/develop/
10+
next if branch =~ %r![^/]+/master!
11+
next if branch =~ %r![^/]+/develop!
1212

1313
if `git branch --contains #{branch}`.each_line.any? { |included| included.strip.chomp =~ /\A(develop|master)\z/ }
14-
ref = branch.sub(/^(?<remote>[^\/]+)\//, '')
14+
ref = branch.sub(%r!^(?<remote>[^/]+)/!, '')
1515
command = "git push --delete #{$~[:remote]} #{ref}"
1616
puts command
1717
unless $noop

0 commit comments

Comments
 (0)