8000 Quote repo names consistently in `gh repo sync` stdout by muzimuzhi · Pull Request #9491 · cli/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Quote repo names consistently in gh repo sync stdout #9491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/repo/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea:

Suggested change
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\" local branch from \"%s\"\n",

Example:

 ✓ Synced the "muzimuzhi:trunk" branch from "cli:trunk"
-✓ Synced the "trunk" branch from cli/cli to local repository
+✓ Synced the "trunk" local branch from "cli/cli:trunk"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Words are hard... 😅 Gonna dump some stream of consciousness, here:

What we're doing is taking the upstream branch and syncing our local branch to it. There are a few sentence constructions that convey that:

  • Synced the "" branch from upstream "" to the local "" branch
  • Synced the local "" branch to the ":" branch
  • Synced the local "" branch with the ":" branch
  • Synced the ":" branch with the local "" branch

I'm not sure your local branch needs to match the upstream name, so keeping the local branch name ambiguous is probably correct. That means all the options above that require don't work 😅

Thus, the valid sentences are

  • Synced the "" from "" to the local repository
  • Synced the ":" to the local repository
  • Synced the local repository with the ":"

ALL of this said, I think we leave it as it is.

And I feel a ton of empathy for those folks that aren't native english speakers... The English language is complicated 😅

Copy link
Contributor Author
@muzimuzhi muzimuzhi Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I can't fully understand what you meant, especially the one "That means all the options above that require don't work 😅". Perhaps because I'm one of non-native English speakers 😢

It seems you pointed out that names of local and remote branches just been in sync may differ, thus some sentence constructions are ambiguous.

Update: Also I wonder why not print all the owner, repo, and branch info all the time.

cs.SuccessIcon(),
opts.Branch,
ghrepo.FullName(srcRepo))
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/repo/sync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Loading
0