Repository: docker/compose
File: pkg/compose/convergence.go (Go)

Code before:
	if err != nil {
		return false, err
	}
	configChanged := actual.Labels[api.ConfigHashLabel] != configHash
	imageUpdated := actual.Labels[api.ImageDigestLabel] != expected.CustomLabels[api.ImageDigestLabel]
	if configChanged || imageUpdated {
		return true, nil
	}

	if c.networks != nil {
		// check the networks container is connected to are the expected ones
		for net := range expected.Networks {
			id := c.networks[net]
			if id == "swarm" {
				// corner-case : swarm overlay network isn't visible until a container is attached
				continue
			}
			found := false
			for _, settings := range actual.NetworkSettings.Networks {
				if settings.NetworkID == id {
					found = true
					break
				}
			}
			if !found {
				// config is up-t-date but container is not connected to network - maybe recreated ?
				return true, nil
			}
		}
	}

	return false, nil
}

func getContainerName(projectName string, service types.ServiceConfig, number int) string {
	name := getDefaultContainerName(projectName, service.Name, strconv.Itoa(number))
	if service.ContainerName != "" {
		name = service.ContainerName
	}
	return name
}

func getDefaultContainerName(projectName, serviceName, index string) string {
	return strings.Join([]string{projectName, serviceName, index}, api.Separator)
}

func getContainerProgressName(container moby.Container) string {
	return "Container " + getCanonicalContainerName(container)
}

func containerEvents(containers Containers, eventFunc func(string) progress.Event) []progress.Event {

Review comment (suggestion):
nit
```suggestion
				// config is up-to-date but container is not connected to network - maybe recreated ?
```

Code after:
	if err != nil {
		return false, err
	}
	configChanged := actual.Labels[api.ConfigHashLabel] != configHash
	imageUpdated := actual.Labels[api.ImageDigestLabel] != expected.CustomLabels[api.ImageDigestLabel]
	if configChanged || imageUpdated {
		return true, nil
	}

	if c.networks != nil {
		// check the networks container is connected to are the expected ones
		for net := range expected.Networks {
			id := c.networks[net]
			if id == "swarm" {
				// corner-case : swarm overlay network isn't visible until a container is attached
				continue
			}
			found := false
			for _, settings := range actual.NetworkSettings.Networks {
				if settings.NetworkID == id {
					found = true
					break
				}
			}
			if !found {
				// config is up-to-date but container is not connected to network - maybe recreated ?
				return true, nil
			}
		}
	}

	return false, nil
}

func getContainerName(projectName string, service types.ServiceConfig, number int) string {
	name := getDefaultContainerName(projectName, service.Name, strconv.Itoa(number))
	if service.ContainerName != "" {
		name = service.ContainerName
	}
	return name
}

func getDefaultContainerName(projectName, serviceName, index string) string {
	return strings.Join([]string{projectName, serviceName, index}, api.Separator)
}

func getContainerProgressName(container moby.Container) string {
	return "Container " + getCanonicalContainerName(container)
}

func containerEvents(containers Containers, eventFunc func(string) progress.Event) []progress.Event {