Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Repo#ls_tree #67

wants to merge 2 commits into from

Conversation

dometto
Copy link
Member

@dometto 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
@dometto dometto changed the title Repo#ls_tree: Repo#ls_tree Jan 11, 2025
Copy link
Member

@bartkamphorst bartkamphorst left a 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 = {})
Copy link
Member

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
Copy link
Member

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|
Copy link
Member

@bartkamphorst bartkamphorst Jan 11, 2025

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) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants