From 914bea816bdfdc6b5bbcd364908fed39f23a7b84 Mon Sep 17 00:00:00 2001 From: Jason Wilder Date: Mon, 18 Aug 2014 12:19:09 -0600 Subject: [PATCH] Handle exports w/ multiple tags on same image --- main.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index e3ff49c..d334b55 100644 --- a/main.go +++ b/main.go @@ -81,12 +81,26 @@ func main() { fatal(err) } - if len(export.Repositories) > 0 { - fatal("This image is a full repository export w/ multiple images in it. " + - "You need to generate the export from a specific image ID or tag.") + // Export may have multiple branches with the same parent. + // We can't handle that currently so abort. + for _, v := range export.Repositories { + commits := map[string]string{} + for tag, commit := range *v { + commits[commit] = tag + } + if len(commits) > 1 { + fatal("This image is a full repository export w/ multiple images in it. " + + "You need to generate the export from a specific image ID or tag.") + } + } start := export.FirstFrom() + // Can't find a FROM, default to root + if start == nil { + start = export.Root() + } + if from != "" { if from == "root" {