Skip to content

Commit 186961d

Browse files
committed
translate remote exists with different url error
1 parent 022af0b commit 186961d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pkg/gui/controllers/remotes_controller.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,14 @@ func (self *RemotesController) addRemoteHelper(remoteName string, remoteUrl stri
185185
func (self *RemotesController) addForkHelper(remoteName string, remoteUrl string, branchToCheckout string) error {
186186
for idx, remote := range self.c.Model().Remotes {
187187
if remote.Name == remoteName {
188-
hasUrl := slices.Contains(remote.Urls, remoteUrl)
189-
if !hasUrl {
190-
return fmt.Errorf("a remote named '%s' already exists with a different URL", remoteName)
188+
hasTheSameUrl := slices.Contains(remote.Urls, remoteUrl)
189+
if !hasTheSameUrl {
190+
return fmt.Errorf("%s", utils.ResolvePlaceholderString(
191+
self.c.Tr.IncompatibleForkAlreadyExistsError,
192+
map[string]string{
193+
"remoteName": remoteName,
194+
},
195+
))
191196
}
192197
self.c.Contexts().Remotes.SetSelection(idx)
193198
return self.fetchAndCheckout(remote, branchToCheckout)

pkg/i18n/english.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ type TranslationSet struct {
525525
AddForkRemote string
526526
AddForkRemoteUsername string
527527
AddForkRemoteTooltip string
528+
IncompatibleForkAlreadyExistsError string
528529
ViewBranches string
529530
EditRemoteName string
530531
EditRemoteUrl string
@@ -1608,6 +1609,7 @@ func EnglishTranslationSet() *TranslationSet {
16081609
AddForkRemoteUsername: `Fork owner (username/org). Use username:branch to check out a branch`,
16091610
AddForkRemote: `Add fork remote`,
16101611
AddForkRemoteTooltip: `Quickly add a fork remote by replacing the owner in the origin URL and optionally check out a branch from new remote.`,
1612+
IncompatibleForkAlreadyExistsError: `Remote {{.remoteName}} already exists and has different URL`,
16111613
ViewBranches: "View branches",
16121614
EditRemoteName: `Enter updated remote name for {{.remoteName}}:`,
16131615
EditRemoteUrl: `Enter updated remote url for {{.remoteName}}:`,

0 commit comments

Comments
 (0)