Commit a362ad51 authored by Mark Florian's avatar Mark Florian

Support worktrees in lefthook/security harness

Our scripts/security-harness did not work with GitLab repositories using
worktrees because:
- It relies on lefthook, which only added support for worktrees in 0.7.5
- It makes an assumption about the location of the pre-push hook path

This change bumps the lefthook gem to 0.7.5 to fix the first problem,
and uses a more robust way to get the pre-push hook path to fix the
second problem.
parent 559744f3
...@@ -690,7 +690,7 @@ GEM ...@@ -690,7 +690,7 @@ GEM
rest-client (~> 2.0) rest-client (~> 2.0)
launchy (2.5.0) launchy (2.5.0)
addressable (~> 2.7) addressable (~> 2.7)
lefthook (0.7.2) lefthook (0.7.5)
letter_opener (1.7.0) letter_opener (1.7.0)
launchy (~> 2.2) launchy (~> 2.2)
letter_opener_web (1.4.0) letter_opener_web (1.4.0)
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
require 'digest' require 'digest'
require 'fileutils' require 'fileutils'
require 'open3'
if ENV['NO_COLOR'] if ENV['NO_COLOR']
SHELL_RED = '' SHELL_RED = ''
...@@ -18,7 +19,7 @@ else ...@@ -18,7 +19,7 @@ else
end end
LEFTHOOK_GLOBAL_CONFIG_PATH = File.expand_path("../lefthook.yml", __dir__) LEFTHOOK_GLOBAL_CONFIG_PATH = File.expand_path("../lefthook.yml", __dir__)
HOOK_PATH = File.expand_path("../.git/hooks/pre-push", __dir__) HOOK_PATH = Open3.capture3("git rev-parse --path-format=absolute --git-path hooks/pre-push")[0].strip
HOOK_DATA = <<~HOOK HOOK_DATA = <<~HOOK
#!/usr/bin/env bash #!/usr/bin/env bash
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment