-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rugged::Diff#tree returns Rugged::Tree instead of its instance #389
Comments
Yeah, this was caused by 93d2d78, specifically this line here: rugged/ext/rugged/rugged_tree.c Line 476 in c0bcaab
Thanks for reporting this issue! |
Can you check #392? Having a |
As a user of I wouldn't say that it makes "no sense". Current implementation of /*
* 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.
*
* If +tree+ or +diffable+ are nil, they will be treated as an empty tree. Passing
* both as `nil` will raise an exception.
*/ Another alternative is just to use different names. Here, in documentation, |
The following works, too: Tree.diff(nil, nil)
Tree.diff(nil, other_tree)
Tree.diff(other_tree, nil) In those cases, what would |
Adding accessors for the left and right side of a diff might be possible, but you have to keep in mind that a diff can also be made against the workdir. I'm not sure what those would return in that case. |
Hm, the /*
* call-seq:
* tree.diff_workdir([options]) -> diff
*
* 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.
*/ |
A diff stands on its own, it doesn't belong to a particular tree any more than blob does. What it might need is a reference to the repository in order to stop a GC run from freeing memory it references, but there's no reason that needs to be public ( If you need more information in your code, then I think passing that information along is bound to work better, as you wouldn't need to assume the diff was created just as you expected it to. |
Thanks @carlosmn! So yeah, the only thing I would find sensible would be to have |
Rugged::Diff#tree returns Rugged::Tree instead of its instance. How to reproduce:
The text was updated successfully, but these errors were encountered: