Quote repo names consistently in gh repo sync stdout (#9491)

* Quote repo names consistently in `gh repo sync` stdout

* Update tests
This commit is contained in:
Yukai Chou 2024-08-22 03:20:45 +08:00 committed by GitHub
parent 779a1203b6
commit c81ccab4b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -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))

View file

@ -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",