From bbe629ae037f1f123fe3b782541f31027a89b6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20M=C3=BCller?= Date: Mon, 24 Jun 2019 11:41:47 +0200 Subject: [PATCH] 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 --- lib/git/lib.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index a698cf3e..9e8d817c 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -113,12 +113,12 @@ def describe(committish=nil, opts={}) arr_opts << '--always' if opts[:always] arr_opts << '--exact-match' if opts[:exact_match] || opts[:"exact-match"] - arr_opts << '--dirty' if opts['dirty'] == true - arr_opts << "--dirty=#{opts['dirty']}" if opts['dirty'].is_a?(String) + arr_opts << '--dirty' if opts[:dirty] == true + arr_opts << "--dirty=#{opts[:dirty]}" if opts['dirty'].is_a?(String) - arr_opts << "--abbrev=#{opts['abbrev']}" if opts[:abbrev] - arr_opts << "--candidates=#{opts['candidates']}" if opts[:candidates] - arr_opts << "--match=#{opts['match']}" if opts[:match] + arr_opts << "--abbrev=#{opts[:abbrev]}" if opts[:abbrev] + arr_opts << "--candidates=#{opts[:candidates]}" if opts[:candidates] + arr_opts << "--match=#{opts[:match]}" if opts[:match] arr_opts << committish if committish