-
Notifications
You must be signed in to change notification settings - Fork 25
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
Repo#ls_tree #67
base: master
Are you sure you want to change the base?
Repo#ls_tree #67
Conversation
dometto
commented
Jan 11, 2025
- add support for non-recursive lstree
- add support for lstree for specific path
* add support for non-recursive lstree * add support for lstree for specific path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the first set of comments, please see if they are still useful.
results = [] | ||
@repo.lookup(sha).tree.walk(:postorder) do |root, entry| | ||
results << ::Gollum::Git::Tree.tree_entry_from_rugged_hash(entry, root) | ||
def lstree(sha, path, options = {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In RJGit adapter, the path
argument in lstree
has a default of nil
. Should we do the same here?
results << ::Gollum::Git::Tree.tree_entry_from_rugged_hash(entry, root) | ||
def lstree(sha, path, options = {}) | ||
|
||
if path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
tree = @repo.lookup(sha).tree
tree = tree / path if path
Instead of the if/else
?
end | ||
results | ||
else | ||
tree.map do |entry| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tree.map { |entry| Gollum::Git::Tree.tree_entry_from_rugged_hash(entry, root) }