Method: Rugged::Config#get_all

Defined in:
ext/rugged/rugged_config.c

#get_all(key) ⇒ Array

Get a list of values for the given config key. Values are always returned as an Array of String, or nil if the given key doesn’t exist in the Config file.

cfg['apply.whitespace'] #=> ['fix']
cfg['diff.renames'] #=> ['true']
cfg['remote.origin.fetch'] #=> ["+refs/heads/*:refs/remotes/origin/*", "+refs/heads/*:refs/lolol/origin/*"]

Returns:

  • (Array)
[View source]

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'ext/rugged/rugged_config.c', line 389

static VALUE rb_git_config_get_all(VALUE self, VALUE key)
{
  git_config *config;
  VALUE list;
  int error;

  Data_Get_Struct(self, git_config, config);

  list = rb_ary_new();
  error = git_config_get_multivar_foreach(
    config, StringValueCStr(key), NULL, each_config_value, (void *)list);

  if (error == GIT_ENOTFOUND)
    return Qnil;

  rugged_exception_check(error);
  return list;
}