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

Rewrite "bashbrew children" and "bashbrew parents" #55

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

tianon
Copy link
Member

@tianon tianon commented Nov 10, 2022

This time, they are distinct implementations because the problem they are solving is inherently different.

For listing children of a given name, we have to walk the entire library (since we only have tag -> FROM mappings, not the reverse, which is fundamentally the question that "children" answers).

On the flip side, listing the parents of a given name is as straightforward as looking up the FROM values and walking until we can't anymore.

In my own testing, these new implementations are significantly more correct, and handle more edge cases (including things we couldn't support before like bashbrew children --depth=1 scratch, bashbrew children mcr.microsoft.com/windows/servercore, etc).

They also more correctly handle edge cases like tags that are FROM a "SharedTag" such that they don't walk up/down both sides of the tree (for example, orientdb:3.2 -> FROM eclipse-temurin:8-jdk, which is both Windows and Linux, even though orientdb:3.2 is Linux-only).

@tianon tianon force-pushed the parent-children-rewrite branch 2 times, most recently from c217aca to 9793925 Compare November 10, 2022 00:38
@tianon
Copy link
Member Author

tianon commented Nov 10, 2022

(this also bumps our minimum Go version to 1.18+)

This time, they are distinct implementations because the problem they are solving is inherently different.

For listing children of a given name, we *have* to walk the entire library (since we only have tag -> FROM mappings, not the reverse, which is fundamentally the question that "children" answers).

On the flip side, listing the parents of a given name is as straightforward as looking up the FROM values and walking until we can't anymore.

In my own testing, these new implementations are significantly more correct, and handle more edge cases (including things we couldn't support before like `bashbrew children --depth=1 scratch`, `bashbrew children mcr.microsoft.com/windows/servercore`, etc).

They also more correctly handle edge cases like tags that are `FROM` a "`SharedTag`" such that they don't walk up/down both sides of the tree (for example, `orientdb:3.2` -> `FROM eclipse-temurin:8-jdk`, which is both Windows *and* Linux, even though `orientdb:3.2` is Linux-only).
@tianon tianon force-pushed the parent-children-rewrite branch from 1d99523 to f54c8e3 Compare November 14, 2022 22:32
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