Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit together with co-authors#1355

Merged
kuychaco merged 69 commits into
masterfrom
ku-niik/co-authors
Mar 26, 2018
Merged

Commit together with co-authors#1355
kuychaco merged 69 commits into
masterfrom
ku-niik/co-authors

Conversation

@kuychaco
Copy link
Copy Markdown
Contributor

@kuychaco kuychaco commented Mar 16, 2018

commit-with-friends

TODO:

  • update user store after initial loading (what if new commits are pulled with new authors?)
  • cache invalidation for getAuthors

In separate PRs:

  • use %x1F delimiter for getRecentCommits
  • hide behind feature flag
  • add new author (use prompt similar to CredentialDialog)
  • get username and avatar url from github graphql API
  • get rid of web committer (like so)
  • consider sorting based on most recent authors or # of commits rather than alphabetically
  • get rid of amend checkbox and implement undo and “amend” right-click instead
    • as is, clicking the amend checkbox will not strip co-author trailers and you could end up with duplicate co-authors. so we'll want to make this change before shipping to beta

/cc @niik @simurai

kuychaco and others added 9 commits March 21, 2018 17:36
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
…tion

Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
(to fix tests)

Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
Copy link
Copy Markdown
Contributor

@simurai simurai left a comment

Choose a reason for hiding this comment

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

How does the list get populated when searching for someone? Would it be possible to show username Real Name instead of Real Name email@address.com? Like GitHub Desktop.

Then it might also be possible to only show a person one time. Otherwise it's hard to decide which one to pick:

image

@kuychaco kuychaco requested a review from smashwilson March 22, 2018 11:38
@kuychaco
Copy link
Copy Markdown
Contributor Author

kuychaco commented Mar 22, 2018

@simurai great question! This PR just pulled author information from Git itself - from the local repository. In another PR we'll grab info from the graphql API and allow people to search via username. We decided on this approach first because we want to cover the base case where the user has a repo but doesn't necessarily have a github remote.

Copy link
Copy Markdown
Contributor

@smashwilson smashwilson left a comment

Choose a reason for hiding this comment

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

Nice ✨ No blocking changes that I see. Merge whenever you're ready 😄

Comment thread keymaps/git.cson Outdated
'.github-Dialog input':
'enter': 'core:confirm'

'body .github-CommitView-coAuthorEditor':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is body needed here for selector specificity reasons?

mentionableUsers: PropTypes.arrayOf(PropTypes.shape({
email: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
})).isRequired,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 for PropTypes.shape(). I know we've been a bit sloppy with our PropTypes sometimes 😄 Although it'll be a moot point if we do go to TypeScript 🤔

// There's probably a better way. I tried finding a regex to do it in one fell swoop but had no luck
const coAuthors = body.split(LINE_ENDING_REGEX).reduce((emails, line) => {
const match = line.match(/\s*Co-authored-by: .*<(.*)>\s*/);
const match = line.match(/^co-authored-by: .*<(.*)>\s*/i);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good call 👍

return [];
} else {
throw err;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

for (const trailer of trailers) {
args.push('--trailer', `${trailer.token}=${trailer.value}`);
}
return this.exec(args, {stdin: commitMessage});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Huh! TIL 🌠

Comment thread lib/views/commit-view.js
if (!fakeEvent.defaultPrevented) {
e.abortKeyBinding();
}
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Huh, wacky 😄

Comment thread lib/views/commit-view.js
'github:co-author:pagedown': this.proxyKeyCode(34),
'github:co-author:end': this.proxyKeyCode(35),
'github:co-author:home': this.proxyKeyCode(36),
'github:co-author:delete': this.proxyKeyCode(46),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Random sidenote: we could move these into a <Commands> view for extra React Points.

Comment thread package.json
"diff": "3.2.0",
"dompurify": "^1.0.3",
"dugite": "1.49.0",
"dugite": "^1.60.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah good call.

Comment thread package.json Outdated
"FilePatchControllerStub": "createFilePatchControllerStub"
}
},
"false": {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, what's this for?


await git.exec(['config', 'user.name', 'Com Mitter']);
await git.exec(['config', 'user.email', 'comitter@place.com']);
await git.exec(['commit', '--allow-empty', '--author="A U Thor <author@site.org>"', '-m', 'Commit together!']);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤣

@smashwilson
Copy link
Copy Markdown
Contributor

Huh. What's up with the failing tests, though? They look unrelated... ?

@kuychaco
Copy link
Copy Markdown
Contributor Author

For the sake of getting this feature out so that others can dog-food and provide input we're going to merge this as-is and implement all remaining to-dos in future PRs.

@kuychaco kuychaco merged commit b994822 into master Mar 26, 2018
@kuychaco kuychaco mentioned this pull request Apr 3, 2018
33 tasks
@smashwilson smashwilson mentioned this pull request Apr 19, 2018
@smashwilson smashwilson deleted the ku-niik/co-authors branch September 21, 2018 00:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants