overcommit 0.74.0 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/overcommit/git_repo.rb +2 -2
- data/lib/overcommit/utils/file_utils.rb +3 -54
- data/lib/overcommit/utils.rb +7 -4
- data/lib/overcommit/version.rb +1 -1
- data/template-dir/hooks/commit-msg +1 -1
- data/template-dir/hooks/overcommit-hook +1 -1
- data/template-dir/hooks/post-checkout +1 -1
- data/template-dir/hooks/post-commit +1 -1
- data/template-dir/hooks/post-merge +1 -1
- data/template-dir/hooks/post-rewrite +1 -1
- data/template-dir/hooks/pre-commit +1 -1
- data/template-dir/hooks/pre-push +1 -1
- data/template-dir/hooks/pre-rebase +1 -1
- data/template-dir/hooks/prepare-commit-msg +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 825a9ffd0ad7bacf35ecb3901ead1f1249085cad5536314434e89ce5ff802d15
|
|
4
|
+
data.tar.gz: f4d3ea4ecbc7d2fe7d2c35e1dd4d44f86e30a2e31ba241366735937952a95c30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 590bcf4bdb5bb506425bbc41050adaa16311baa45f37071d1ffc0a9d96412f508f552eeea2278946bbab622af3aa0a6d216d388c520e41804a4f4dc7ee69e381
|
|
7
|
+
data.tar.gz: 73222064a9fcc44930ae9c027c19bb851004d5d1000303854b52c2650ef52ef29177f783e9faa5e064717be3ea03e676512a1dd631ddf68f459acbeb46e08df4
|
data/lib/overcommit/git_repo.rb
CHANGED
|
@@ -163,10 +163,10 @@ module Overcommit
|
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
merge_mode_file = Overcommit::Utils.git_path('MERGE_MODE')
|
|
166
|
-
@merge_mode = File.
|
|
166
|
+
@merge_mode = File.read(merge_mode_file) if File.exist?(merge_mode_file)
|
|
167
167
|
|
|
168
168
|
merge_msg_file = Overcommit::Utils.git_path('MERGE_MSG')
|
|
169
|
-
@merge_msg = File.
|
|
169
|
+
@merge_msg = File.read(merge_msg_file) if File.exist?(merge_msg_file)
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
# Store any relevant files that are present when repo is in the middle of a
|
|
@@ -1,70 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'overcommit/os'
|
|
4
|
-
require 'overcommit/subprocess'
|
|
5
|
-
|
|
6
3
|
module Overcommit::Utils
|
|
7
4
|
# Utility functions for file IO.
|
|
8
5
|
module FileUtils
|
|
9
6
|
class << self
|
|
10
|
-
# When the host OS is Windows, uses the `mklink` command to create an
|
|
11
|
-
# NTFS symbolic link from `new_name` to `old_name`. Otherwise delegates
|
|
12
|
-
# to `File.symlink`
|
|
13
7
|
def symlink(old_name, new_name)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
result = win32_mklink_cmd(old_name, new_name)
|
|
17
|
-
result.status
|
|
8
|
+
File.symlink(old_name, new_name)
|
|
18
9
|
end
|
|
19
10
|
|
|
20
|
-
# When the host OS is Windows, uses the `dir` command to check whether
|
|
21
|
-
# `file_name` is an NTFS symbolic link. Otherwise delegates to
|
|
22
|
-
# `File.symlink`.
|
|
23
11
|
def symlink?(file_name)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
result = win32_dir_cmd(file_name)
|
|
27
|
-
win32_symlink?(result.stdout)
|
|
12
|
+
File.symlink?(file_name)
|
|
28
13
|
end
|
|
29
14
|
|
|
30
|
-
# When the host OS is Windows, uses the `dir` command to check whether
|
|
31
|
-
# `link_name` is an NTFS symbolic link. If so, it parses the target from
|
|
32
|
-
# the command output. Otherwise raises an `ArgumentError`. Delegates to
|
|
33
|
-
# `File.readlink` if the host OS is not Windows.
|
|
34
15
|
def readlink(link_name)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
result = win32_dir_cmd(link_name)
|
|
38
|
-
|
|
39
|
-
unless win32_symlink?(result.stdout)
|
|
40
|
-
raise ArgumentError, "#{link_name} is not a symlink"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Extract symlink target from output, which looks like:
|
|
44
|
-
# 11/13/2012 12:53 AM <SYMLINK> mysymlink [C:\Windows\Temp\somefile.txt]
|
|
45
|
-
result.stdout[/\[(.+)\]/, 1]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
def win32_dir_cmd(file_name)
|
|
51
|
-
Overcommit::Subprocess.spawn(
|
|
52
|
-
%W[cmd.exe /c dir #{win32_fix_pathsep(file_name)}]
|
|
53
|
-
)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def win32_mklink_cmd(old_name, new_name)
|
|
57
|
-
Overcommit::Subprocess.spawn(
|
|
58
|
-
%W[cmd.exe /c mklink #{win32_fix_pathsep(new_name)} #{win32_fix_pathsep(old_name)}]
|
|
59
|
-
)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def win32_fix_pathsep(path)
|
|
63
|
-
path.tr(File::SEPARATOR, Overcommit::OS::SEPARATOR)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def win32_symlink?(dir_output)
|
|
67
|
-
!(dir_output =~ /<SYMLINK>/).nil?
|
|
16
|
+
File.readlink(link_name)
|
|
68
17
|
end
|
|
69
18
|
end
|
|
70
19
|
end
|
data/lib/overcommit/utils.rb
CHANGED
|
@@ -166,9 +166,12 @@ module Overcommit
|
|
|
166
166
|
return if Process.ppid.zero?
|
|
167
167
|
|
|
168
168
|
if OS.windows?
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
result = execute([
|
|
170
|
+
'powershell.exe', '-NoProfile', '-NonInteractive', '-Command',
|
|
171
|
+
"(Get-CimInstance Win32_Process -Filter 'ProcessId = #{Process.ppid}').CommandLine",
|
|
172
|
+
])
|
|
173
|
+
command = result.stdout.strip
|
|
174
|
+
command if result.success? && !command.empty?
|
|
172
175
|
elsif OS.cygwin?
|
|
173
176
|
# Cygwin's `ps` command behaves differently than the traditional
|
|
174
177
|
# Linux version, but a comparable `procps` is provided to compensate.
|
|
@@ -176,7 +179,7 @@ module Overcommit
|
|
|
176
179
|
else
|
|
177
180
|
`ps -ocommand= -p #{Process.ppid}`.chomp
|
|
178
181
|
end
|
|
179
|
-
rescue Errno::EPERM, Errno::ENOENT
|
|
182
|
+
rescue Errno::EPERM, Errno::ENOENT, ChildProcess::LaunchError
|
|
180
183
|
# Process information may not be available, such as inside sandboxed environments
|
|
181
184
|
nil
|
|
182
185
|
end
|
data/lib/overcommit/version.rb
CHANGED
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
data/template-dir/hooks/pre-push
CHANGED
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|
|
@@ -27,7 +27,7 @@ if hook_type == 'overcommit-hook'
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
|
30
|
-
File.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
30
|
+
File.read('.overcommit.yml', encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
|
|
31
31
|
gemfile = Regexp.last_match(1)
|
|
32
32
|
|
|
33
33
|
if gemfile
|