diff --git a/clients/cli/cmd/internal/pull.go b/clients/cli/cmd/internal/pull.go index 0e5d4f2c..a8d1fcac 100644 --- a/clients/cli/cmd/internal/pull.go +++ b/clients/cli/cmd/internal/pull.go @@ -68,7 +68,7 @@ func (cmd *PullCommand) Run(config *phrase.Config) error { target.Params.Branch = optional.NewString(cmd.Branch) } - val, ok := localesCache[LocalesCacheKey{target.ProjectID, target.Params.Branch.Value()}] + val, ok := localesCache[LocalesCacheKey{target.ProjectID, target.GetBranch()}] if !ok || len(val) == 0 { if cmd.Branch != "" { continue diff --git a/clients/cli/cmd/internal/pull_target.go b/clients/cli/cmd/internal/pull_target.go index 7b68c7f7..b64cec74 100644 --- a/clients/cli/cmd/internal/pull_target.go +++ b/clients/cli/cmd/internal/pull_target.go @@ -18,7 +18,7 @@ type Targets []*Target func (targets Targets) GetAllLocalesCacheKeys() []LocalesCacheKey { localesCacheKeys := []LocalesCacheKey{} for _, target := range targets { - localesCacheKeys = append(localesCacheKeys, LocalesCacheKey{target.ProjectID, target.Params.Branch.Value()}) + localesCacheKeys = append(localesCacheKeys, LocalesCacheKey{target.ProjectID, target.GetBranch()}) } return localesCacheKeys } @@ -32,6 +32,13 @@ type Target struct { RemoteLocales []*phrase.Locale } +func (target *Target) GetBranch() string { + if target.Params != nil { + return target.Params.Branch.Value() + } + return "" +} + func (target *Target) CheckPreconditions() error { if err := paths.Validate(target.File, target.FileFormat, ""); err != nil { return err