Adds initial support for recomposing commits from a branch#4713
Adds initial support for recomposing commits from a branch#4713
Conversation
|
Note: we have a bug with storing merge bases for branches at the moment (we are choosing the upstream rather than the upstream's merge base) which causes the composer to find no diff when you make a local branch from a remote one. I will address this separately and rebase this on top of it once it is addressed. |
8561a88 to
7c9fab4
Compare
099b6f0 to
07bf736
Compare
It was not a bug. It looked for the upstream only when the local wasn't available. But that logic wasn't working well in several cases (it would return zero commit responses), so I just used recursive merge target look-up until we find one with commits. |
| export function parseCoAuthorsFromGitCommit(commit: GitCommit): GitCommitIdentityShape[] { | ||
| const coAuthors: GitCommitIdentityShape[] = []; | ||
| if (!commit.message) return coAuthors; | ||
|
|
||
| const coAuthorRegex = /^Co-authored-by:\s*(.+?)(?:\s*<(.+?)>)?\s*$/gm; | ||
| let match; | ||
| while ((match = coAuthorRegex.exec(commit.message)) !== null) { | ||
| const [, name, email] = match; | ||
| if (name) { | ||
| coAuthors.push({ name: name.trim(), email: email?.trim(), date: commit.date }); | ||
| } | ||
| } | ||
|
|
||
| return coAuthors; | ||
| } |
There was a problem hiding this comment.
This will be great to add in other commit authorship/avatar content throughout GitLens.
There was a problem hiding this comment.
Will make a note to pull it into a shared util file later. Thanks!
07bf736 to
12b86ff
Compare
Closes #4598
Closes #4599
New command is
Recompose Commits (Preview)and is accessible from branches in views and graph, and from Command Palette.