Method: Rugged::Repository#reset_path
- Defined in:
- ext/rugged/rugged_repo.c
permalink #reset_path(pathspecs, target = nil) ⇒ nil
Updates entries in the index from the target
commit tree, matching the given pathspecs
.
Passing a nil target
will result in removing entries in the index matching the provided pathspecs.
-
pathspecs
: list of pathspecs to operate on (String
orArray
ofString
objects) -
target
(optional): Rugged::Commit, Rugged::Tag or rev that resolves to a commit or tag object.
Examples:
reset_path(File.join('subdir','file.txt'), '441034f860c1d5d90e4188d11ae0d325176869a8') #=> nil
1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 |
# File 'ext/rugged/rugged_repo.c', line 1861
static VALUE rb_git_repo_reset_path(int argc, VALUE *argv, VALUE self)
{
git_repository *repo;
git_object *target = NULL;
git_strarray pathspecs;
VALUE rb_target, rb_paths;
int error = 0;
pathspecs.strings = NULL;
pathspecs.count = 0;
Data_Get_Struct(self, git_repository, repo);
rb_scan_args(argc, argv, "11", &rb_paths, &rb_target);
rugged_rb_ary_to_strarray(rb_paths, &pathspecs);
if (!NIL_P(rb_target))
target = rugged_object_get(repo, rb_target, GIT_OBJ_ANY);
error = git_reset_default(repo, target, &pathspecs);
xfree(pathspecs.strings);
git_object_free(target);
rugged_exception_check(error);
return Qnil;
}
|