Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions cmd/bashbrew/cmd-deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ func cmdFamily(parents bool, c *cli.Context) error {
// now the real work
seen := map[string]bool{}
for _, repo := range depsRepos {
r, err := fetch(repo)
if err != nil {
return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
}
tagsToConsider := []string{}

if r, err := fetch(repo); err == nil {
// fetch succeeded, must be an object we know about so let's do a proper listing/search
for _, entry := range r.Entries() {
if applyConstraints && r.SkipConstraints(entry) {
continue
Expand All @@ -113,11 +112,25 @@ func cmdFamily(parents bool, c *cli.Context) error {
continue
}

if len(r.TagEntries) == 1 {
// we can't include SharedTags here or else they'll make "bashbrew parents something:simple" show the parents of the shared tags too ("nats:scratch" leading to both "nats:alpine" *and* "nats:windowsservercore" instead of just "nats:alpine" like it should), so we have to reimplement bits of "r.Tags" to exclude them
tagRepo := path.Join(namespace, r.RepoName)
for _, rawTag := range entry.Tags {
tag := tagRepo + ":" + rawTag
tagsToConsider = append(tagsToConsider, tag)
}
} else {
// if we're doing something like "bashbrew children full-repo" (or "bashbrew children full-repo:shared-tag"), we *need* to include the SharedTags or else things that are "FROM full-repo:shared-tag" won't show up 😅 ("bashbrew children adoptopenjdk" was just "cassandra" instead of the full list)
tagsToConsider = append(tagsToConsider, r.Tags(namespace, false, entry)...)
}
}
} else {
if err != nil {
return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
}
}

for _, tag := range tagsToConsider {
nodes := []topsortDepthNodes{}
if parents {
nodes = append(nodes, topsortDepthNodes{
Expand Down Expand Up @@ -161,7 +174,6 @@ func cmdFamily(parents bool, c *cli.Context) error {
}
}
}
}

return nil
}