Method: Rugged::Index#update
- Defined in:
- ext/rugged/rugged_index.c
permalink #<<(entry) ⇒ nil #<<(path) ⇒ nil #add(entry) ⇒ nil #add(path) ⇒ nil #update(entry) ⇒ nil #update(path) ⇒ nil
Add a new entry to the index or update an existing entry in the index.
If passed a path
to an existing, readable file relative to the workdir, creates a new index entry based on this file.
Alternatively, a new index entry can be created by passing a Hash containing all key/value pairs of an index entry.
Any gitignore rules that might match path
(or the :path
value of the entry hash) are ignored.
If the index entry at path
(or :path
) currently contains a merge conflict, it will no longer be marked as conflicting and the data about the conflict will be moved into the “resolve undo” (REUC) section of the index.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'ext/rugged/rugged_index.c', line 290
static VALUE rb_git_index_add(VALUE self, VALUE rb_entry)
{
git_index *index;
int error = 0;
Data_Get_Struct(self, git_index, index);
if (TYPE(rb_entry) == T_HASH) {
git_index_entry entry;
rb_git_indexentry_toC(&entry, rb_entry);
error = git_index_add(index, &entry);
}
else if (TYPE(rb_entry) == T_STRING) {
error = git_index_add_bypath(index, StringValueCStr(rb_entry));
}
else {
rb_raise(rb_eTypeError,
"Expecting a hash defining an Index Entry or a path to a file in the repository");
}
rugged_exception_check(error);
return Qnil;
}
|