Method: Rugged::Tree#diff_workdir

Defined in:
ext/rugged/rugged_tree.c

#diff_workdir([options]) ⇒ Object

Returns a diff between a tree and the current workdir.

The tree object will be used as the “old file” side of the diff, while the content of the current workdir will be used for the “new file” side.

See Rugged::Tree#diff for a list of options that can be passed.



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'ext/rugged/rugged_tree.c', line 428

static VALUE rb_git_tree_diff_workdir(int argc, VALUE *argv, VALUE self)
{
  git_tree *tree;
  git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
  git_repository *repo;
  git_diff *diff;
  VALUE owner, rb_options;
  int error;

  rb_scan_args(argc, argv, "00:", &rb_options);
  rugged_parse_diff_options(&opts, rb_options);

  TypedData_Get_Struct(self, git_tree, &rugged_object_type, tree);
  owner = rugged_owner(self);
  Data_Get_Struct(owner, git_repository, repo);

  error = git_diff_tree_to_workdir(&diff, repo, tree, &opts);

  xfree(opts.pathspec.strings);
  rugged_exception_check(error);

  return rugged_diff_new(rb_cRuggedDiff, owner, diff);
}