Skip to content

Commit

Permalink
fix(clone): provide helpful message when fork conflicts cause an error (
Browse files Browse the repository at this point in the history
#139)

* suggest fix for fork conflict

* newlines

---------

Co-authored-by: Danny Ranson <[email protected]>
  • Loading branch information
Dan7-7-7 and Danny Ranson authored Jul 15, 2024
1 parent 6997ad4 commit fb6a1c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/clone/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func run(c *cobra.Command, _ []string) {
err = g.Pull(pullFromUpstreamActivity.Writer(), repoDirPath, "upstream", defaultBranch)
if err != nil {
pullFromUpstreamActivity.EndWithFailure(err)
logger.Printf("\nWe weren't able to pull the latest upstream changes into your fork of %s. This is probably because you have a pre-existing fork with commits ahead of upstream. Please change this or delete your fork, and try again.\n", repo.FullRepoName)
errorCount++
continue
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/clone/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ func TestItLogsPullErrorsButContinuesToTryAll(t *testing.T) {
assert.NoError(t, err)
assert.Contains(t, out, "Pulling latest changes from org1/repo1")
assert.Contains(t, out, "Pulling latest changes from org2/repo2")
assert.Contains(t, out, "We weren't able to pull the latest upstream changes into your fork of org1/repo1")
assert.Contains(t, out, "We weren't able to pull the latest upstream changes into your fork of org2/repo2")
assert.Contains(t, out, "turbolift clone completed with errors")
assert.Contains(t, out, "2 repos errored")

Expand Down

0 comments on commit fb6a1c4

Please sign in to comment.