Skip to content

Commit 1acabe6

Browse files
sdsShane da Silva
authored and
Shane da Silva
committed
Ignore GIT_TEMPLATE_DIR environment variable in specs
Explicitly specify the template directory as an empty string in specs so that Overcommit spec runs aren't effected by the `GIT_TEMPLATE_DIR` environment variable. Change-Id: Idd79324355c777254584a28ee7c8f22db295d2e3 Reviewed-on: http://gerrit.causes.com/35604 Reviewed-by: Shane da Silva <shane@causes.com> Tested-by: Shane da Silva <shane@causes.com>
1 parent 1dfbd2a commit 1acabe6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/overcommit/installer.rb

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def run(target, options)
2121
def install
2222
log.log "Installing hooks into #{@target}"
2323

24+
ensure_hooks_directory
2425
install_master_hook
2526
install_hook_symlinks
2627

@@ -41,6 +42,10 @@ def hooks_path
4142
File.join(absolute_target, '.git', 'hooks')
4243
end
4344

45+
def ensure_hooks_directory
46+
FileUtils.mkdir_p(hooks_path)
47+
end
48+
4449
def validate_target
4550
absolute_target = File.expand_path(@target)
4651

spec/support/git_spec_helpers.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module GitSpecHelpers
66

77
def repo(name = 'some-repo', &block)
88
directory(name) do
9-
`git init`
9+
`git init --template=""` # Ensure no template directory is applied
10+
`mkdir -p .git/hooks` # Since we don't specify template, need to create ourselves
1011
block.call if block_given?
1112
end
1213
end

0 commit comments

Comments
 (0)