Skip to content

Commit db918c0

Browse files
HParkercarlosmn
authored andcommitted
each_key returns individual keys not wrapped in an internal array
Previously keys where returned in nested arrays i.e. [["user.email"]...] this returns the behavior to just returning keys The behavior changed in #803 likely due to a copy paste mistake. This returns this to the previous behavior
1 parent 068075a commit db918c0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ext/rugged/rugged_config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int cb_config__each_key(const git_config_entry *entry, void *payload)
173173
{
174174
int *exception = (int *) payload;
175175

176-
rb_protect(rb_yield, rb_ary_new3(1, rb_str_new_utf8(entry->name)), exception);
176+
rb_protect(rb_yield, rb_str_new_utf8(entry->name), exception);
177177

178178
return (*exception != 0) ? GIT_EUSER : GIT_OK;
179179
}

test/config_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ def test_snapshot
4343
assert_nil snapshot['new.value']
4444
end
4545

46+
def test_each_key_is_a_string
47+
config = @repo.config
48+
config.each_key do |key|
49+
assert key.is_a?(String)
50+
end
51+
end
52+
4653
def test_transaction
4754
config = Rugged::Config.new(File.join(@repo.path, 'config'))
4855
config['section.name'] = 'value'

0 commit comments

Comments
 (0)