Permalink
Browse files

moved regexp to git config

  • Loading branch information...
1 parent 8342839 commit cc8940a5f0b26b722eb386b0f1ef4e10f2afa075 @hggh committed Apr 6, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 git-hooks/pre-receive
View
@@ -3,9 +3,18 @@
# Licensed under the Apache License, Version 2.0
# regular expression for tag names
-tag_regexp = '^(prod|dev)\/[0-9]{4}-[0-9]{2}-[0-9]{2}_d[0-9]+$'
+# git config hooks.receivetagregexp '^prod\/[0-9]{4}-[0-9]{2}-[0-9]{2}_d[0-9]+$'
-rexp = Regexp.new(tag_regexp)
+tag_regexp = %x{git config hooks.receivetagregexp}.strip
+
+exit 0 if tag_regexp == ""
+
+begin
+ rexp = Regexp.new(tag_regexp)
+rescue Exception => e
+ puts "Error: Could not parse regexp: #{e.message}"
+ exit 1
+end
message = Array.new
while line = STDIN.gets

0 comments on commit cc8940a

Please sign in to comment.