mirror of
https://github.com/containers/podman.git
synced 2025-06-28 06:18:57 +08:00
Rename parameters of imageNameForSaveDestination
... to make their relationship clear, at the very least. Should not change behavior (but does not add unit tests). Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
This commit is contained in:

committed by
Atomic Bot

parent
c27c6c6707
commit
b142cc6b4e
@ -144,20 +144,23 @@ func saveCmd(c *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func imageNameForSaveDestination(newImage *libpodImage.Image, source string) string {
|
// imageNameForSaveDestination returns a Docker-like reference appropriate for saving img,
|
||||||
if !strings.Contains(newImage.ID(), source) {
|
// which the user referred to as imgUserInput; or an empty string, if there is no appropriate
|
||||||
|
// reference.
|
||||||
|
func imageNameForSaveDestination(img *libpodImage.Image, imgUserInput string) string {
|
||||||
|
if !strings.Contains(img.ID(), imgUserInput) {
|
||||||
prepend := ""
|
prepend := ""
|
||||||
if !strings.Contains(source, libpodImage.DefaultLocalRepo) {
|
if !strings.Contains(imgUserInput, libpodImage.DefaultLocalRepo) {
|
||||||
// we need to check if localhost was added to the image name in NewFromLocal
|
// we need to check if localhost was added to the image name in NewFromLocal
|
||||||
for _, name := range newImage.Names() {
|
for _, name := range img.Names() {
|
||||||
// if the user searched for the image whose tag was prepended with localhost, we'll need to prepend localhost to successfully search
|
// if the user searched for the image whose tag was prepended with localhost, we'll need to prepend localhost to successfully search
|
||||||
if strings.Contains(name, libpodImage.DefaultLocalRepo) && strings.Contains(name, source) {
|
if strings.Contains(name, libpodImage.DefaultLocalRepo) && strings.Contains(name, imgUserInput) {
|
||||||
prepend = fmt.Sprintf("%s/", libpodImage.DefaultLocalRepo)
|
prepend = fmt.Sprintf("%s/", libpodImage.DefaultLocalRepo)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s%s", prepend, source)
|
return fmt.Sprintf("%s%s", prepend, imgUserInput)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user