From c81ccab4b8bb1ef1c774f4ba9851e9dcb11fa5e7 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 22 Aug 2024 03:20:45 +0800 Subject: [PATCH] Quote repo names consistently in `gh repo sync` stdout (#9491) * Quote repo names consistently in `gh repo sync` stdout * Update tests --- pkg/cmd/repo/sync/sync.go | 2 +- pkg/cmd/repo/sync/sync_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/cmd/repo/sync/sync.go b/pkg/cmd/repo/sync/sync.go index 87badc7a154..4418079b7bd 100644 --- a/pkg/cmd/repo/sync/sync.go +++ b/pkg/cmd/repo/sync/sync.go @@ -156,7 +156,7 @@ func syncLocalRepo(opts *SyncOptions) error { if opts.IO.IsStdoutTTY() { cs := opts.IO.ColorScheme() - fmt.Fprintf(opts.IO.Out, "%s Synced the \"%s\" branch from %s to local repository\n", + fmt.Fprintf(opts.IO.Out, "%s Synced the \"%s\" branch from \"%s\" to local repository\n", cs.SuccessIcon(), opts.Branch, ghrepo.FullName(srcRepo)) diff --git a/pkg/cmd/repo/sync/sync_test.go b/pkg/cmd/repo/sync/sync_test.go index 8b9e4352fe7..227e2a6a264 100644 --- a/pkg/cmd/repo/sync/sync_test.go +++ b/pkg/cmd/repo/sync/sync_test.go @@ -129,7 +129,7 @@ func Test_SyncRun(t *testing.T) { mgc.On("IsDirty").Return(false, nil).Once() mgc.On("MergeFastForward", "FETCH_HEAD").Return(nil).Once() }, - wantStdout: "✓ Synced the \"trunk\" branch from OWNER/REPO to local repository\n", + wantStdout: "✓ Synced the \"trunk\" branch from \"OWNER/REPO\" to local repository\n", }, { name: "sync local repo with parent - notty", @@ -162,7 +162,7 @@ func Test_SyncRun(t *testing.T) { mgc.On("IsDirty").Return(false, nil).Once() mgc.On("MergeFastForward", "FETCH_HEAD").Return(nil).Once() }, - wantStdout: "✓ Synced the \"trunk\" branch from OWNER2/REPO2 to local repository\n", + wantStdout: "✓ Synced the \"trunk\" branch from \"OWNER2/REPO2\" to local repository\n", }, { name: "sync local repo with parent and force specified", @@ -179,7 +179,7 @@ func Test_SyncRun(t *testing.T) { mgc.On("IsDirty").Return(false, nil).Once() mgc.On("ResetHard", "FETCH_HEAD").Return(nil).Once() }, - wantStdout: "✓ Synced the \"trunk\" branch from OWNER/REPO to local repository\n", + wantStdout: "✓ Synced the \"trunk\" branch from \"OWNER/REPO\" to local repository\n", }, { name: "sync local repo with specified source repo and force specified", @@ -197,7 +197,7 @@ func Test_SyncRun(t *testing.T) { mgc.On("IsDirty").Return(false, nil).Once() mgc.On("ResetHard", "FETCH_HEAD").Return(nil).Once() }, - wantStdout: "✓ Synced the \"trunk\" branch from OWNER2/REPO2 to local repository\n", + wantStdout: "✓ Synced the \"trunk\" branch from \"OWNER2/REPO2\" to local repository\n", }, { name: "sync local repo with parent and not fast forward merge", @@ -257,7 +257,7 @@ func Test_SyncRun(t *testing.T) { mgc.On("CurrentBranch").Return("test", nil).Once() mgc.On("UpdateBranch", "trunk", "FETCH_HEAD").Return(nil).Once() }, - wantStdout: "✓ Synced the \"trunk\" branch from OWNER/REPO to local repository\n", + wantStdout: "✓ Synced the \"trunk\" branch from \"OWNER/REPO\" to local repository\n", }, { name: "sync local repo with parent - create new branch", @@ -271,7 +271,7 @@ func Test_SyncRun(t *testing.T) { mgc.On("CurrentBranch").Return("test", nil).Once() mgc.On("CreateBranch", "trunk", "FETCH_HEAD", "origin/trunk").Return(nil).Once() }, - wantStdout: "✓ Synced the \"trunk\" branch from OWNER/REPO to local repository\n", + wantStdout: "✓ Synced the \"trunk\" branch from \"OWNER/REPO\" to local repository\n", }, { name: "sync remote fork with parent with new api - tty",