Skip to content

Let my people clone - #1213

Merged
shiftkey merged 18 commits into
masterfrom
let-my-people-clone
Apr 18, 2017
Merged

shiftkey merged 18 commits into
masterfrom
let-my-people-clone

Conversation

@joshaber

Copy link
Copy Markdown
Contributor

Fixes #1163

@shiftkey
shiftkey self-requested a review April 14, 2017 01:51
@shiftkey shiftkey self-assigned this Apr 14, 2017

@shiftkey shiftkey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good - one suggestion for cleanup.

This doesn't address a public owner/repo alias when unauthenticated - not sure if that's worth tackling here as it's getting further into edge cases.


if (identifier) {
const api = new API(account)
const api = new API(account || Account.anonymous())

This comment was marked as spam.

@joshaber

Copy link
Copy Markdown
Contributor Author

Oh don't worry, it was still WIP 😅

@joshaber joshaber changed the title [WIP] Let my people clone Let my people clone Apr 14, 2017
@joshaber

joshaber commented Apr 14, 2017 •

Copy link
Copy Markdown
Contributor Author

This is ready now 👍

giphy

@shiftkey

Copy link
Copy Markdown
Member

Oh don't worry, it was still WIP 😅

@shiftkey
shiftkey dismissed their stale review April 14, 2017 23:01

It was a WIP, oops

@joshaber

Copy link
Copy Markdown
Contributor Author

But now it's ready 🎭

const path = this.state.path
const cloneDetails = await this.resolveCloneDetails()
if (!cloneDetails) {
const error = new Error(`We couldn't find that repository. Make sure it's spelled right and you're logged in.`)

This comment was marked as spam.

Comment thread app/src/lib/find-account.ts Outdated
} else {
return false
}
} catch (e) {

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/find-account.ts Outdated
// First try parsing it as a full URL. If that doesn't work, try parsing it
// as an owner/name shortcut. And if that fails then throw our hands in the
// air because we truly don't care.
// We have a couple strategies to try to figure out what account we should

This comment was marked as spam.

Comment thread app/src/lib/find-account.ts Outdated
* @param accounts - the list of active GitHub and GitHub Enterprise accounts
*/
export async function findAccountForRemote(url: string, accounts: ReadonlyArray<Account>): Promise<Account> {
export async function findAccountForRemote(url: string, accounts: ReadonlyArray<Account>): Promise<Account | null> {

This comment was marked as spam.

Comment thread app/src/lib/find-account.ts Outdated
const sortedAccounts = Array.from(accounts).sort((a1, a2) => {
if (a1.endpoint === getDotComAPIEndpoint()) {
return -1
if (a1.token.length) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@shiftkey shiftkey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So close, just noticed a couple of destructuring places that tidy things up a bit.


if (dotComAccount) {
return dotComAccount
if (account) {

This comment was marked as spam.


const parsedOwnerAndName = parseOwnerAndName(url)
const parsedOwnerAndName = parseOwnerAndName(urlOrRepositoryAlias)
if (parsedOwnerAndName) {

This comment was marked as spam.

@joshaber

Copy link
Copy Markdown
Contributor Author

🏜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants