From f33af3bcfb97fe1ae02a27a3ee13fa47b5ff9ae9 Mon Sep 17 00:00:00 2001
From: Patrick Motard <motard19@gmail.com>
Date: Mon, 17 Jan 2022 13:21:20 -0600
Subject: [PATCH] Repeatable hash type flags bugfix.

They treated like every other type now. Instead of merging each key/val
into a hash, each flag is treated like it's own hash that should be put
into an array.

fixes #768
---
 lib/thor/parser/options.rb  | 4 +---
 spec/parser/options_spec.rb | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/thor/parser/options.rb b/lib/thor/parser/options.rb
index 8c1bbe7f2..7f004c3c5 100644
--- a/lib/thor/parser/options.rb
+++ b/lib/thor/parser/options.rb
@@ -149,9 +149,7 @@ def check_unknown!
   protected
 
     def assign_result!(option, result)
-      if option.repeatable && option.type == :hash
-        (@assigns[option.human_name] ||= {}).merge!(result)
-      elsif option.repeatable
+      if option.repeatable
         (@assigns[option.human_name] ||= []) << result
       else
         @assigns[option.human_name] = result
diff --git a/spec/parser/options_spec.rb b/spec/parser/options_spec.rb
index b1e50fbfa..fcf050445 100644
--- a/spec/parser/options_spec.rb
+++ b/spec/parser/options_spec.rb
@@ -417,7 +417,7 @@ def remaining
 
       it "allows multiple values if repeatable is specified" do
         create :attributes => Thor::Option.new("attributes", :type => :hash, :repeatable => true)
-        expect(parse("--attributes", "name:one", "foo:1", "--attributes", "name:two", "bar:2")["attributes"]).to eq({"name"=>"two", "foo"=>"1", "bar" => "2"})
+        expect(parse("--attributes", "name:one", "foo:1", "--attributes", "name:two", "bar:2")["attributes"]).to eq([{"name"=>"one", "foo"=>"1"}, {"name"=>"two", "bar" => "2"}])
       end
     end