danger 9.3.0 → 9.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28e1b237f9fc7857aca64881f72c1c247ec9f83d0f22985866f7b7b59e407551
4
- data.tar.gz: b1ffee7037fd3e8bfd25103557ec78f51792c1f24c46f2d5ce624b38c8582761
3
+ metadata.gz: 719588ed490c1115e2439aabacb0dd400e1852bf03a0f25514b26dcb08e0ad9e
4
+ data.tar.gz: 7426ab63483923ceffd843789c473a46f7726b1f9057a74b558bbeeb2c6948d9
5
5
  SHA512:
6
- metadata.gz: 1b196a2f4f291b2a961948bb56518921285142763c8265478d6050992756fb4fef2bcc33fdbfa15187e8384a16f68b20903fd41475ab55578a3dbcd5fea60d75
7
- data.tar.gz: 81f1adb962e7031baf701487d29e37ccd7daeb499471adbc1c663e1da8db87333c312d1c9875fa6a571acba9a429d6cae3a49fac3cf2ff4270a9c157ff4df469
6
+ metadata.gz: 9fa39fb8d2a11ac973a1c4b7a9647bef1a0bfdd36411d403e1f3121b3a1b7490dbaa7489c17f018fa1ae88be4ceccc6ee213267ee32133dfbf162cb3bab93e6f
7
+ data.tar.gz: 01ba1c81cfdb4a37661826f913ed3227e1432fbbede1d69e6521eacfd4d6c8595f8a5140134c431446b591f81027797a4f93b67b674fcfd9c860d452575ea5fb
@@ -8,13 +8,9 @@ module Danger
8
8
 
9
9
  def diff_for_folder(folder, from: "master", to: "HEAD", lookup_top_level: false)
10
10
  self.folder = folder
11
- git_top_level = folder
12
- if lookup_top_level
13
- Dir.chdir(folder) do
14
- git_top_level = exec("rev-parse --show-toplevel")
15
- end
16
- end
17
- repo = Git.open git_top_level
11
+ git_top_level = find_git_top_level_if_needed!(folder, lookup_top_level)
12
+
13
+ repo = Git.open(git_top_level)
18
14
 
19
15
  ensure_commitish_exists!(from)
20
16
  ensure_commitish_exists!(to)
@@ -168,6 +164,26 @@ module Danger
168
164
  def commit_is_ref?(commit)
169
165
  /[a-f0-9]{5,40}/ !~ commit
170
166
  end
167
+
168
+ def find_git_top_level_if_needed!(folder, lookup_top_level)
169
+ git_top_level = Dir.chdir(folder) { exec("rev-parse --show-toplevel") }
170
+ return git_top_level if lookup_top_level
171
+
172
+ # To keep backward compatibility, `GitRepo#diff_for_folder` expects folder
173
+ # to be top level git directory or requires `true` to `lookup_top_level`.
174
+ # https://github.com/danger/danger/pull/1178
175
+ return folder if compare_path(git_top_level, folder)
176
+
177
+ message = "#{folder} is not the top level git directory. Pass correct path or `true` to `lookup_top_level` option for `diff_for_folder`"
178
+ raise ArgumentError, message
179
+ end
180
+
181
+ # Compare given paths as realpath. Return true if both are same.
182
+ # `git rev-parse --show-toplevel` returns a path resolving symlink. In rspec, given path can
183
+ # be a temporary directory's path created under a symlinked directory `/var`.
184
+ def compare_path(path1, path2)
185
+ Pathname.new(path1).realdirpath == Pathname.new(path2).realdirpath
186
+ end
171
187
  end
172
188
  end
173
189
 
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "9.3.0".freeze
2
+ VERSION = "9.3.1".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.3.0
4
+ version: 9.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-21 00:00:00.000000000 Z
12
+ date: 2023-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.13.0
110
+ version: '1.13'
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.13.0
117
+ version: '1.13'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: kramdown
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -163,14 +163,14 @@ dependencies:
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '5.0'
166
+ version: '6.0'
167
167
  type: :runtime
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '5.0'
173
+ version: '6.0'
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: terminal-table
176
176
  requirement: !ruby/object:Gem::Requirement