libgit2 / libgit2/rugged

Is Rugged::Commit.diff right?

Open
#561 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

I use walker find a commit but when i get it`s diff, i think the result is wrong.

rugged/lib/rugged/commit.rb

    def diff(*args)
      args.unshift(parents.first) if args.size == 1 && args.first.is_a?(Hash)
      self.tree.diff(*args)
    end

rugged/lib/rugged/tree.rb

    def diff(other = nil, options = nil)
      Tree.diff(repo, self, other, options)
    end

but
rugged/ext/rugged/rugged_tree.c

 *  call-seq:
 *    Tree.diff(repo, tree, diffable[, options]) -> diff
 *
 *  Returns a diff between the `tree` and the diffable object that was given.
 *  +diffable+ can either be a +Rugged::Commit+, a +Rugged::Tree+, a +Rugged::Index+,
 *  or +nil+.
 *
 *  The +tree+ object will be used as the "old file" side of the diff, while the
 *  parent tree or the +diffable+ object will be used for the "new file" side.

so all seams right, but as the comment say The +tree+ object will be used as the "old file" side of the diff, while the parent tree or the +diffable+ object will be used for the "new file" side, is parent used as new side right?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the call flow in rugged/lib/rugged/commit.rb and rugged/lib/rugged/tree.rb into the Tree.diff implementation in rugged/ext/rugged/rugged_tree.c. Reproduce the reported walker commit diff, then compare the observed old and new sides with the C documentation and clarify whether the parent is used as the new side.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, git, ruby
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.