Skip to content

Commit bbe629a

Browse files
muellerjJonas Mueller
authored and
Jonas Mueller
committed
Fix hash keys in #describe
Currently, the symbolized key is checked for presence and then the value for the non-symbolized one is used. This works for Hashes with indifferent access (like in rails etc.) but fails for a simple example like ```ruby Git.open(".").describe("HEAD", abbrev: 0) => Git::GitExecuteError (git '--git-dir=/folder/to/repo/.git' '--work-tree=/folder/to/repo' describe '--abbrev=' 'HEAD' 2>&1:error: option `abbrev' expects a numerical value) ``` Changed all references to the symbolized version (since the method signature suggests `@param [{Symbol=>Object}]`). Signed-off-by: Jonas Mueller <jonas-mueller@mailbox.org>
1 parent 9bd4407 commit bbe629a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/git/lib.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ def describe(committish=nil, opts={})
113113
arr_opts << '--always' if opts[:always]
114114
arr_opts << '--exact-match' if opts[:exact_match] || opts[:"exact-match"]
115115

116-
arr_opts << '--dirty' if opts['dirty'] == true
117-
arr_opts << "--dirty=#{opts['dirty']}" if opts['dirty'].is_a?(String)
116+
arr_opts << '--dirty' if opts[:dirty] == true
117+
arr_opts << "--dirty=#{opts[:dirty]}" if opts['dirty'].is_a?(String)
118118

119-
arr_opts << "--abbrev=#{opts['abbrev']}" if opts[:abbrev]
120-
arr_opts << "--candidates=#{opts['candidates']}" if opts[:candidates]
121-
arr_opts << "--match=#{opts['match']}" if opts[:match]
119+
arr_opts << "--abbrev=#{opts[:abbrev]}" if opts[:abbrev]
120+
arr_opts << "--candidates=#{opts[:candidates]}" if opts[:candidates]
121+
arr_opts << "--match=#{opts[:match]}" if opts[:match]
122122

123123
arr_opts << committish if committish
124124

0 commit comments

Comments
 (0)