Method: Rugged::Config#delete

Defined in:
ext/rugged/rugged_config.c

#delete(key) ⇒ Boolean

Delete the given key from the config file. Return true if the deletion was successful, or false if the key was not found in the Config file.

The config file is immediately updated on disk.

Returns:

  • (Boolean)

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'ext/rugged/rugged_config.c', line 156

static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
{
  git_config *config;
  int error;

  Data_Get_Struct(self, git_config, config);
  Check_Type(rb_key, T_STRING);

  error = git_config_delete_entry(config, StringValueCStr(rb_key));
  if (error == GIT_ENOTFOUND)
    return Qfalse;

  rugged_exception_check(error);
  return Qtrue;
}