Skip to content

Commit 1ea831a

Browse files
Use new git_config_get_string_buf.
`git_config_get_string` can only be used on config snapshots.
1 parent 8c4e21c commit 1ea831a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ext/rugged/rugged_config.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,22 @@ static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
8787
static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
8888
{
8989
git_config *config;
90-
const char *value;
90+
git_buf buf = { NULL };
9191
int error;
92+
VALUE rb_result;
9293

9394
Data_Get_Struct(self, git_config, config);
9495
Check_Type(rb_key, T_STRING);
9596

96-
error = git_config_get_string(&value, config, StringValueCStr(rb_key));
97+
error = git_config_get_string_buf(&buf, config, StringValueCStr(rb_key));
9798
if (error == GIT_ENOTFOUND)
9899
return Qnil;
99100

100101
rugged_exception_check(error);
101-
return rb_str_new_utf8(value);
102+
rb_result = rb_str_new_utf8(buf.ptr);
103+
git_buf_free(&buf);
104+
105+
return rb_result;
102106
}
103107

104108
/*

0 commit comments

Comments
 (0)