Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Review] Request from 'xystushi' @ 'xystushi/git-review/review_130812_send_pull_requests_to_upstream' #61

Merged
Merged
Prev Previous commit
Next Next commit
Do not load duplicate config values.
  • Loading branch information
xystushi committed Aug 12, 2013
commit 1fcebd121069ea44c8637534fe3021934a1fe4bb
2 changes: 1 addition & 1 deletion lib/git-review/local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def load_config
@config = {}
config_list.split("\n").each do |line|
key, value = line.split(/=/, 2)
if @config[key]
if @config[key] && @config[key] != value
@config[key] = [@config[key]].flatten << value
else
@config[key] = value
Expand Down
8 changes: 7 additions & 1 deletion spec/git-review/local_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
subject.load_config.should == {'foo' => ['bar', 'bar2'], 'baz' => 'qux'}
end

it 'does not keep duplicate values for a key' do
config = "foo=bar\nbaz=qux\nfoo=bar"
subject.stub(:config_list).and_return(config)
subject.load_config.should == {'foo' => 'bar', 'baz' => 'qux'}
end

end

describe '#branch_exists?' do
Expand Down Expand Up @@ -211,4 +217,4 @@

end

end
end