Skip to content

Commit 15ce4c2

Browse files
committed
Change post-commit and post-merge scripts to symlinks
These should be symlinks so we don't need to update the master hook in multiple places. Add some tests to enforce this going forward. Change-Id: I9c6bcbcd4129aaa46c9d30f4be265dded4770150 Reviewed-on: http://gerrit.causes.com/46928 Reviewed-by: Shane da Silva <shane.dasilva@brigade.com> Tested-by: Shane da Silva <shane.dasilva@brigade.com>
1 parent 5b5f9ea commit 15ce4c2

File tree

3 files changed

+27
-162
lines changed

3 files changed

+27
-162
lines changed

spec/integration/template_dir_spec.rb

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'spec_helper'
2+
3+
describe 'template directory' do
4+
let(:template_dir) { File.join(Overcommit::OVERCOMMIT_HOME, 'template-dir') }
5+
let(:hooks_dir) { File.join(template_dir, 'hooks') }
6+
7+
it 'contains a hooks directory' do
8+
File.directory?(hooks_dir).should == true
9+
end
10+
11+
describe 'the hooks directory' do
12+
it 'contains the master hook as an actual file with content' do
13+
master_hook = File.join(hooks_dir, 'overcommit-hook')
14+
File.exist?(master_hook).should == true
15+
File.size?(master_hook).should > 0
16+
File.symlink?(master_hook).should == false
17+
end
18+
19+
it 'contains all other hooks as symlinks to the master hook' do
20+
Overcommit::Utils.supported_hook_types.each do |hook_type|
21+
File.symlink?(File.join(hooks_dir, hook_type)).should == true
22+
end
23+
end
24+
end
25+
end

template-dir/hooks/post-commit

-81
This file was deleted.

template-dir/hooks/post-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
overcommit-hook

template-dir/hooks/post-merge

-81
This file was deleted.

template-dir/hooks/post-merge

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
overcommit-hook

0 commit comments

Comments
 (0)