rabbitt-githooks 1.5.3 → 1.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb31ed1dec8235280845f3b79a0903d99a6aa83a
4
- data.tar.gz: 8476c63b4dddc57ca1715d235c4b4be3b2581366
3
+ metadata.gz: 537d8b0aba4a78077a2a83811f61275e92675096
4
+ data.tar.gz: 35f7835256d75573db5d1e2ab1390b0b9dba7e91
5
5
  SHA512:
6
- metadata.gz: 053d3879bd2ba1a74b78b268e05c7b234bab3cd683e3ee34009409b8bf2ff7bf8d0151ef88e5bd250f2f162dd8c018be493ee4867a4ec5471a585cb8a765de2f
7
- data.tar.gz: ae10de10f024a5023dba124539d642640f5c67cefefd462efb4577931091f622a5da761892a971116ed143eed51741ca3793b56188236d97c9d51c64400485c7
6
+ metadata.gz: d0a01ba51f8a80696f79fd3f1acac240419cc59d032b65473c5b9ba98808c7222f062fe31b4bf6a3fe3f9b22cdc9c96d7ebe2c0acb4953faa8ee4906e0c10758
7
+ data.tar.gz: 5da65f00da85068723387ff697f53feb488d1f2418021de602b4a22258282f3471f60772c9ea455b499361f55d79cbeb0b58a2e97e511035d195fde4c0647368
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbitt-githooks (1.5.3)
4
+ rabbitt-githooks (1.5.4)
5
5
  rainbow (~> 2.0.0)
6
6
  thor (~> 0.18)
7
7
 
data/lib/githooks/hook.rb CHANGED
@@ -173,7 +173,7 @@ module GitHooks
173
173
  @hook.repository
174
174
  end
175
175
 
176
- def files
176
+ def files # rubocop:disable Metrics/AbcSize
177
177
  @files ||= begin
178
178
  options = {
179
179
  staged: hook.staged,
@@ -182,8 +182,15 @@ module GitHooks
182
182
  }
183
183
 
184
184
  if %w[ commit-msg pre-push ].include? hook.phase
185
- if (parent_sha = repository.last_unpushed_commit_parent)
186
- options.merge!(ref: parent_sha)
185
+ begin
186
+ if (parent_sha = repository.last_unpushed_commit_parent)
187
+ options.merge!(ref: parent_sha)
188
+ end
189
+ rescue Error::RemoteNotSet
190
+ # remote not set yet, so let's only focus on what's tracked for now
191
+ options[:tracked] = true
192
+ options[:untracked] = false
193
+ options[:staged] = false
187
194
  end
188
195
  end
189
196
 
@@ -60,11 +60,13 @@ module GitHooks
60
60
  end
61
61
 
62
62
  def get_root_path(path)
63
- git('rev-parse', '--show-toplevel', chdir: path).tap do |result|
64
- unless result.status.success? && result.output !~ /not a git repository/i
65
- fail Error::NotAGitRepo, "Unable to find a valid git repo in #{path}"
66
- end
67
- end.output.strip
63
+ @root_path ||= begin
64
+ git('rev-parse', '--show-toplevel', chdir: path).tap do |result|
65
+ unless result.status.success? && result.output !~ /not a git repository/i
66
+ fail Error::NotAGitRepo, "Unable to find a valid git repo in #{path}"
67
+ end
68
+ end.output.strip
69
+ end
68
70
  end
69
71
 
70
72
  def stash
@@ -18,5 +18,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
18
18
  =end
19
19
 
20
20
  module GitHooks
21
- VERSION = '1.5.3' unless defined? VERSION
21
+ VERSION = '1.5.4' unless defined? VERSION
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitt-githooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl P. Corliss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow