]> nos-oignons.net Git - gestion-adh.git/blob - bin/pre-receive-hook
Remove cruft
[gestion-adh.git] / bin / pre-receive-hook
1 #!/usr/bin/ruby1.9.1
2 #-*- coding: utf-8 -*-
3
4 require 'rubygems'
5 require 'bundler'
6 Bundler.setup
7
8 require 'nos_oignons/git'
9 require 'nos_oignons/subscriptions'
10
11 $stdin.readlines.each do |ref_line|
12   old_value, new_value, ref_name = ref_line.rstrip.split(' ', 3)
13   IO.popen(['git', 'diff', '--name-status', "#{old_value}..#{new_value}"]) do |io|
14     handle_modified_files(io) do |file|
15       next unless file.start_with?("#{SUBSCRIPTIONS_ROOT}/")
16       if !is_valid_subscription_file?(new_value, file)
17         $stderr.puts "Désolé : #{file} n'a pas le bon format !"
18         exit 1
19       end
20     end
21   end
22 end