File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Overcommit Changelog
2
2
3
+ ## master (unreleased)
4
+
5
+ * Gracefully handle breaking behavior in upstream Psych gem to support YAML aliases.
6
+
3
7
## 0.57.0
4
8
5
9
* Fix ` CommitMsg ` hooks to be able to call ` modified_lines_in_file ` .
Original file line number Diff line number Diff line change @@ -24,13 +24,16 @@ def default_configuration
24
24
# @option logger [Overcommit::Logger]
25
25
# @return [Overcommit::Configuration]
26
26
def load_from_file ( file , options = { } )
27
- hash =
28
- if yaml = YAML . load_file ( file )
29
- yaml . to_hash
30
- else
31
- { }
27
+ # Psych 4 introduced breaking behavior that doesn't support aliases by
28
+ # default. Explicitly enable aliases if the option is available.
29
+ yaml =
30
+ begin
31
+ YAML . load_file ( file , aliases : true )
32
+ rescue ArgumentError
33
+ YAML . load_file ( file )
32
34
end
33
35
36
+ hash = yaml ? yaml . to_hash : { }
34
37
Overcommit ::Configuration . new ( hash , options )
35
38
end
36
39
end
You can’t perform that action at this time.
0 commit comments