From 6bf82cd128ce3c0c6da32da8b3a1ba2c793fb644 Mon Sep 17 00:00:00 2001 From: say25 Date: Fri, 27 Mar 2020 20:32:23 -0500 Subject: [PATCH 1/8] Add Windows Rider Support --- app/src/lib/editors/win32.ts | 59 ++++++++++++++++++++++++++++ docs/technical/editor-integration.md | 2 + 2 files changed, 61 insertions(+) diff --git a/app/src/lib/editors/win32.ts b/app/src/lib/editors/win32.ts index d3cbdf2fe..121a14533 100644 --- a/app/src/lib/editors/win32.ts +++ b/app/src/lib/editors/win32.ts @@ -25,6 +25,7 @@ export enum ExternalEditor { SlickEdit = 'SlickEdit', Webstorm = 'JetBrains Webstorm', Phpstorm = 'JetBrains Phpstorm', + Rider = 'JetBrains Rider', } export function parse(label: string): ExternalEditor | null { @@ -64,6 +65,9 @@ export function parse(label: string): ExternalEditor | null { if (label === ExternalEditor.Phpstorm) { return ExternalEditor.Phpstorm } + if (label === ExternalEditor.Rider) { + return ExternalEditor.Rider + } return null } @@ -352,6 +356,15 @@ function getRegistryKeys( 'SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\PhpStorm 2020.1', }, ] + case ExternalEditor.Rider: + return [ + // Rider 2019.3.4 + { + key: HKEY.HKEY_LOCAL_MACHINE, + subKey: + 'SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\JetBrains Rider 2019.3.4', + }, + ] default: return assertNever(editor, `Unknown external editor: ${editor}`) @@ -393,6 +406,8 @@ function getExecutableShim( return Path.join(installLocation, 'bin', 'webstorm.exe') case ExternalEditor.Phpstorm: return Path.join(installLocation, 'bin', 'phpstorm.exe') + case ExternalEditor.Rider: + return Path.join(installLocation, 'bin', 'rider64.exe') default: return assertNever(editor, `Unknown external editor: ${editor}`) } @@ -453,6 +468,11 @@ function isExpectedInstallation( return ( displayName.startsWith('PhpStorm') && publisher === 'JetBrains s.r.o.' ) + case ExternalEditor.Rider: + return ( + displayName.startsWith('JetBrains Rider') && + publisher === 'JetBrains s.r.o.' + ) default: return assertNever(editor, `Unknown external editor: ${editor}`) } @@ -616,6 +636,36 @@ function extractApplicationInformation( return { displayName, publisher, installLocation } } + if (editor === ExternalEditor.Rider) { + let displayName = '' + let publisher = '' + let installLocation = '' + + for (const item of keys) { + // NOTE: + // Webstorm adds the current release number to the end of the Display Name, below checks for "PhpStorm" + if ( + item.name === 'DisplayName' && + item.type === RegistryValueType.REG_SZ && + item.data.startsWith('JetBrains Rider ') + ) { + displayName = 'JetBrains Rider' + } else if ( + item.name === 'Publisher' && + item.type === RegistryValueType.REG_SZ + ) { + publisher = item.data + } else if ( + item.name === 'InstallLocation' && + item.type === RegistryValueType.REG_SZ + ) { + installLocation = item.data + } + } + + return { displayName, publisher, installLocation } + } + return assertNever(editor, `Unknown external editor: ${editor}`) } @@ -679,6 +729,7 @@ export async function getAvailableEditors(): Promise< slickeditPath, webstormPath, phpstormPath, + riderPath, ] = await Promise.all([ findApplication(ExternalEditor.Atom), findApplication(ExternalEditor.AtomBeta), @@ -692,6 +743,7 @@ export async function getAvailableEditors(): Promise< findApplication(ExternalEditor.SlickEdit), findApplication(ExternalEditor.Webstorm), findApplication(ExternalEditor.Phpstorm), + findApplication(ExternalEditor.Rider), ]) if (atomPath) { @@ -787,5 +839,12 @@ export async function getAvailableEditors(): Promise< }) } + if (riderPath) { + results.push({ + editor: ExternalEditor.Rider, + path: riderPath, + }) + } + return results } diff --git a/docs/technical/editor-integration.md b/docs/technical/editor-integration.md index 9081dc4da..6c7a6c0b3 100644 --- a/docs/technical/editor-integration.md +++ b/docs/technical/editor-integration.md @@ -31,6 +31,7 @@ These editors are currently supported: - [Typora](https://typora.io/) - [SlickEdit](https://www.slickedit.com) - [JetBrains WebStorm](https://www.jetbrains.com/webstorm/) + - [JetBrains Rider](https://www.jetbrains.com/rider/) These are defined in an enum at the top of the file: @@ -45,6 +46,7 @@ export enum ExternalEditor { CFBuilder = 'ColdFusion Builder', Typora = 'Typora', SlickEdit = 'SlickEdit', + Rider = 'JetBrains Rider', } ``` From 5d9aad9920835fefa74f7301e28cb5b1b77743b5 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sun, 29 Mar 2020 13:45:41 +0200 Subject: [PATCH 2/8] Add support for PyCharm as external editor on macOS --- app/src/lib/editors/darwin.ts | 4 ++++ docs/technical/editor-integration.md | 1 + 2 files changed, 5 insertions(+) diff --git a/app/src/lib/editors/darwin.ts b/app/src/lib/editors/darwin.ts index e45f4bca0..21226eee8 100644 --- a/app/src/lib/editors/darwin.ts +++ b/app/src/lib/editors/darwin.ts @@ -12,6 +12,7 @@ export enum ExternalEditor { SublimeText = 'Sublime Text', BBEdit = 'BBEdit', PhpStorm = 'PhpStorm', + PyCharm = 'PyCharm', RubyMine = 'RubyMine', TextMate = 'TextMate', Brackets = 'Brackets', @@ -52,6 +53,9 @@ export function parse(label: string): ExternalEditor | null { if (label === ExternalEditor.PhpStorm) { return ExternalEditor.PhpStorm } + if (label === ExternalEditor.PyCharm) { + return ExternalEditor.PyCharm + } if (label === ExternalEditor.RubyMine) { return ExternalEditor.RubyMine } diff --git a/docs/technical/editor-integration.md b/docs/technical/editor-integration.md index 9081dc4da..9a14aea49 100644 --- a/docs/technical/editor-integration.md +++ b/docs/technical/editor-integration.md @@ -254,6 +254,7 @@ These editors are currently supported: - [Sublime Text](https://www.sublimetext.com/) - [BBEdit](http://www.barebones.com/products/bbedit/) - [PhpStorm](https://www.jetbrains.com/phpstorm/) + - [PyCharm](https://www.jetbrains.com/pycharm/) - [RubyMine](https://www.jetbrains.com/rubymine/) - [IntelliJ IDEA](https://www.jetbrains.com/idea/) - [TextMate](https://macromates.com) From 67fce941ca55d423e3d572e94195e306f83f17bb Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sun, 29 Mar 2020 16:37:35 +0200 Subject: [PATCH 3/8] Add PyCharm paths --- app/src/lib/editors/darwin.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/lib/editors/darwin.ts b/app/src/lib/editors/darwin.ts index 21226eee8..86ed44621 100644 --- a/app/src/lib/editors/darwin.ts +++ b/app/src/lib/editors/darwin.ts @@ -115,6 +115,8 @@ function getBundleIdentifiers(editor: ExternalEditor): ReadonlyArray { return ['com.barebones.bbedit'] case ExternalEditor.PhpStorm: return ['com.jetbrains.PhpStorm'] + case ExternalEditor.PyCharm: + return ['com.jetbrains.PyCharm'] case ExternalEditor.RubyMine: return ['com.jetbrains.RubyMine'] case ExternalEditor.IntelliJ: @@ -181,6 +183,8 @@ function getExecutableShim( return Path.join(installPath, 'Contents', 'Helpers', 'bbedit_tool') case ExternalEditor.PhpStorm: return Path.join(installPath, 'Contents', 'MacOS', 'phpstorm') + case ExternalEditor.PyCharm: + return Path.join(installPath, 'Contents', 'MacOS', 'pycharm') case ExternalEditor.RubyMine: return Path.join(installPath, 'Contents', 'MacOS', 'rubymine') case ExternalEditor.TextMate: @@ -246,6 +250,7 @@ export async function getAvailableEditors(): Promise< sublimePath, bbeditPath, phpStormPath, + pyCharmPath, rubyMinePath, textMatePath, bracketsPath, @@ -266,6 +271,7 @@ export async function getAvailableEditors(): Promise< findApplication(ExternalEditor.SublimeText), findApplication(ExternalEditor.BBEdit), findApplication(ExternalEditor.PhpStorm), + findApplication(ExternalEditor.PyCharm), findApplication(ExternalEditor.RubyMine), findApplication(ExternalEditor.TextMate), findApplication(ExternalEditor.Brackets), @@ -314,6 +320,10 @@ export async function getAvailableEditors(): Promise< results.push({ editor: ExternalEditor.PhpStorm, path: phpStormPath }) } + if (pyCharmPath) { + results.push({ editor: ExternalEditor.PyCharm, path: pyCharmPath }) + } + if (rubyMinePath) { results.push({ editor: ExternalEditor.RubyMine, path: rubyMinePath }) } From 7b9dfe37b74a0281b8076c83452102a3eb099389 Mon Sep 17 00:00:00 2001 From: Steven Yeh Date: Mon, 30 Mar 2020 09:46:17 -0500 Subject: [PATCH 4/8] Fix Comment --- app/src/lib/editors/win32.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/lib/editors/win32.ts b/app/src/lib/editors/win32.ts index 30545a8ca..5fc1e4c6f 100644 --- a/app/src/lib/editors/win32.ts +++ b/app/src/lib/editors/win32.ts @@ -675,7 +675,7 @@ function extractApplicationInformation( for (const item of keys) { // NOTE: - // Webstorm adds the current release number to the end of the Display Name, below checks for "PhpStorm" + // JetBrains Rider adds the current release number to the end of the Display Name, below checks for "JetBrains Rider" if ( item.name === 'DisplayName' && item.type === RegistryValueType.REG_SZ && From 4c68dbc943d3c118a4ec6db883f1fb2f52314a17 Mon Sep 17 00:00:00 2001 From: say25 Date: Mon, 30 Mar 2020 10:28:57 -0500 Subject: [PATCH 5/8] Run the Linter --- app/src/lib/editors/win32.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/lib/editors/win32.ts b/app/src/lib/editors/win32.ts index 5fc1e4c6f..de93af465 100644 --- a/app/src/lib/editors/win32.ts +++ b/app/src/lib/editors/win32.ts @@ -664,7 +664,7 @@ function extractApplicationInformation( const displayName = getKeyOrEmpty(keys, 'DisplayName') const publisher = getKeyOrEmpty(keys, 'Publisher') const installLocation = getKeyOrEmpty(keys, 'DisplayIcon') - + return { displayName, publisher, installLocation } } @@ -694,7 +694,7 @@ function extractApplicationInformation( installLocation = item.data } } - + return { displayName, publisher, installLocation } } @@ -879,7 +879,7 @@ export async function getAvailableEditors(): Promise< path: notepadPlusPlusPath, }) } - + if (riderPath) { results.push({ editor: ExternalEditor.Rider, From ed3772457bcb5c9e655aff60d2530b31d344f24c Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 31 Mar 2020 10:48:58 +0200 Subject: [PATCH 6/8] Do not store a full commit on each branch tip --- app/src/lib/git/for-each-ref.ts | 30 +++---------------- app/src/lib/stores/git-store.ts | 8 ----- .../lib/stores/helpers/tutorial-assessor.ts | 4 ++- app/src/models/branch.ts | 11 +++++-- app/src/ui/lib/configure-git-user.tsx | 1 + 5 files changed, 17 insertions(+), 37 deletions(-) diff --git a/app/src/lib/git/for-each-ref.ts b/app/src/lib/git/for-each-ref.ts index 46ee5718b..2d3ab3d86 100644 --- a/app/src/lib/git/for-each-ref.ts +++ b/app/src/lib/git/for-each-ref.ts @@ -2,14 +2,9 @@ import { git } from './core' import { GitError } from 'dugite' import { Repository } from '../../models/repository' -import { Commit } from '../../models/commit' import { Branch, BranchType } from '../../models/branch' import { CommitIdentity } from '../../models/commit-identity' import { ForkedRemotePrefix } from '../../models/remote' -import { - getTrailerSeparatorCharacters, - parseRawUnfoldedTrailers, -} from './interpret-trailers' const ForksReferencesPrefix = `refs/remotes/${ForkedRemotePrefix}` @@ -29,11 +24,7 @@ export async function getBranches( '%(objectname:short)', // short SHA '%(author)', '%(committer)', - '%(parent)', // parent SHAs '%(symref)', - '%(subject)', - '%(body)', - '%(trailers:unfold,only)', `%${delimiter}`, // indicate end-of-line as %(body) may contain newlines ].join('%00') @@ -65,8 +56,6 @@ export async function getBranches( return [] } - const trailerSeparators = await getTrailerSeparatorCharacters(repository) - const branches = [] for (const [ix, line] of lines.entries()) { @@ -93,22 +82,11 @@ export async function getBranches( throw new Error(`Couldn't parse committer identity for '${shortSha}'`) } - const parentSHAs = pieces[7].split(' ') - const symref = pieces[8] - const summary = pieces[9] - const body = pieces[10] - const trailers = parseRawUnfoldedTrailers(pieces[11], trailerSeparators) - - const tip = new Commit( + const symref = pieces[7] + const branchTip = { sha, - shortSha, - summary, - body, author, - committer, - parentSHAs, - trailers - ) + } const type = ref.startsWith('refs/head') ? BranchType.Local @@ -128,7 +106,7 @@ export async function getBranches( } branches.push( - new Branch(name, upstream.length > 0 ? upstream : null, tip, type) + new Branch(name, upstream.length > 0 ? upstream : null, branchTip, type) ) } diff --git a/app/src/lib/stores/git-store.ts b/app/src/lib/stores/git-store.ts index 80203f55e..e6c52dd2d 100644 --- a/app/src/lib/stores/git-store.ts +++ b/app/src/lib/stores/git-store.ts @@ -280,14 +280,6 @@ export class GitStore extends BaseStore { this.refreshDefaultBranch() this.refreshRecentBranches(recentBranchNames) this.checkPullWithRebase() - - const commits = this._allBranches.map(b => b.tip) - - for (const commit of commits) { - this.commitLookup.set(commit.sha, commit) - } - - this.emitNewCommitsLoaded(commits) this.emitUpdate() } diff --git a/app/src/lib/stores/helpers/tutorial-assessor.ts b/app/src/lib/stores/helpers/tutorial-assessor.ts index 694cf1c8f..0667628f4 100644 --- a/app/src/lib/stores/helpers/tutorial-assessor.ts +++ b/app/src/lib/stores/helpers/tutorial-assessor.ts @@ -105,10 +105,12 @@ export class OnboardingTutorialAssessor { const { tip } = branchesState if (tip.kind === TipState.Valid) { + const commit = repositoryState.commitLookup.get(tip.branch.tip.sha) + // For some reason sometimes the initial commit has a parent sha // listed as an empty string... // For now I'm filtering those out. Would be better to prevent that from happening - return tip.branch.tip.parentSHAs.some(x => x.length > 0) + return commit !== undefined && commit.parentSHAs.some(x => x.length > 0) } return false diff --git a/app/src/models/branch.ts b/app/src/models/branch.ts index 1c85c219c..abe2f6654 100644 --- a/app/src/models/branch.ts +++ b/app/src/models/branch.ts @@ -1,5 +1,6 @@ import { Commit } from './commit' import { removeRemotePrefix } from '../lib/remove-remote-prefix' +import { CommitIdentity } from './commit-identity' // NOTE: The values here matter as they are used to sort // local and remote branches, Local should come before Remote @@ -19,6 +20,12 @@ export interface ICompareResult extends IAheadBehind { readonly commits: ReadonlyArray } +/** Basic data about the latest commit on the branch. */ +export interface IBranchTip { + readonly sha: string + readonly author: CommitIdentity +} + /** Default rules for where to create a branch from */ export enum StartPoint { CurrentBranch = 'CurrentBranch', @@ -57,13 +64,13 @@ export class Branch { * * @param name The short name of the branch. E.g., `master`. * @param upstream The remote-prefixed upstream name. E.g., `origin/master`. - * @param tip The commit associated with this branch + * @param tip Basic information (sha and author) of the latest commit on the branch. * @param type The type of branch, e.g., local or remote. */ public constructor( public readonly name: string, public readonly upstream: string | null, - public readonly tip: Commit, + public readonly tip: IBranchTip, public readonly type: BranchType ) {} diff --git a/app/src/ui/lib/configure-git-user.tsx b/app/src/ui/lib/configure-git-user.tsx index 8231d8645..4769bb2cd 100644 --- a/app/src/ui/lib/configure-git-user.tsx +++ b/app/src/ui/lib/configure-git-user.tsx @@ -164,6 +164,7 @@ export class ConfigureGitUser extends React.Component< author, author, [], + [], [] ) const emoji = new Map() From 4398886dcff046e7c25eb3eb12cc9f5d836ecbd9 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 31 Mar 2020 11:11:08 +0200 Subject: [PATCH 7/8] Adapt unit tests to the simplified branch head data --- app/test/unit/git/branch-test.ts | 2 +- app/test/unit/git/checkout-test.ts | 13 ---------- app/test/unit/git/for-each-ref-test.ts | 14 +++------- .../unit/git/rebase/detect-conflict-test.ts | 6 ++--- app/test/unit/group-branches-test.ts | 26 +++++++++---------- app/test/unit/infer-comparison-branch-test.ts | 24 +++++++---------- 6 files changed, 28 insertions(+), 57 deletions(-) diff --git a/app/test/unit/git/branch-test.ts b/app/test/unit/git/branch-test.ts index 16ddcad3e..7dd308ed2 100644 --- a/app/test/unit/git/branch-test.ts +++ b/app/test/unit/git/branch-test.ts @@ -80,7 +80,7 @@ describe('git/branch', () => { expect(onBranch.branch.tip.sha).toEqual( 'dfa96676b65e1c0ed43ca25492252a5e384c8efd' ) - expect(onBranch.branch.tip.shortSha).toEqual('dfa9667') + expect(onBranch.branch.tip.author.name).toEqual('Brendan Forster') }) it('returns non-origin remote', async () => { diff --git a/app/test/unit/git/checkout-test.ts b/app/test/unit/git/checkout-test.ts index 4971394f5..79bbffcbb 100644 --- a/app/test/unit/git/checkout-test.ts +++ b/app/test/unit/git/checkout-test.ts @@ -24,25 +24,12 @@ describe('git/checkout', () => { type: BranchType.Local, tip: { sha: '', - shortSha: '', - summary: '', - body: '', author: { name: '', email: '', date: new Date(), tzOffset: 0, }, - committer: { - name: '', - email: '', - date: new Date(), - tzOffset: 0, - }, - authoredByCommitter: true, - parentSHAs: [], - trailers: [], - coAuthors: [], }, remote: null, } diff --git a/app/test/unit/git/for-each-ref-test.ts b/app/test/unit/git/for-each-ref-test.ts index bbe78b7ed..d8fb2472d 100644 --- a/app/test/unit/git/for-each-ref-test.ts +++ b/app/test/unit/git/for-each-ref-test.ts @@ -29,10 +29,7 @@ describe('git/for-each-ref', () => { expect(commitWithBody.tip.sha).toBe( 'dfa96676b65e1c0ed43ca25492252a5e384c8efd' ) - expect(commitWithBody.tip.shortSha).toBe('dfa9667') - expect(commitWithBody.tip.summary).toBe('this is a commit title') - expect(commitWithBody.tip.body).toContain('lucky last') - expect(commitWithBody.tip.parentSHAs).toHaveLength(1) + expect(commitWithBody.tip.author.name).toBe('Brendan Forster') const commitNoBody = branches[1] expect(commitNoBody.name).toBe('commit-with-no-body') @@ -40,18 +37,13 @@ describe('git/for-each-ref', () => { expect(commitNoBody.tip.sha).toBe( '49ec1e05f39eef8d1ab6200331a028fb3dd96828' ) - expect(commitNoBody.tip.shortSha).toBe('49ec1e0') - expect(commitNoBody.tip.summary).toBe('this is a commit title') - expect(commitNoBody.tip.body).toHaveLength(0) - expect(commitNoBody.tip.parentSHAs).toHaveLength(1) + expect(commitNoBody.tip.author.name).toBe('Brendan Forster') const master = branches[2] expect(master.name).toBe('master') expect(master.upstream).toBeNull() expect(master.tip.sha).toBe('b9ccfc3307240b86447bca2bd6c51a4bb4ade493') - expect(master.tip.shortSha).toBe('b9ccfc3') - expect(master.tip.summary).toBe('stubbed a README') - expect(master.tip.parentSHAs).toHaveLength(1) + expect(master.tip.author.name).toBe('Brendan Forster') }) it('should return empty list for empty repo', async () => { diff --git a/app/test/unit/git/rebase/detect-conflict-test.ts b/app/test/unit/git/rebase/detect-conflict-test.ts index e9dcacdbf..49434495c 100644 --- a/app/test/unit/git/rebase/detect-conflict-test.ts +++ b/app/test/unit/git/rebase/detect-conflict-test.ts @@ -9,7 +9,6 @@ import { rebase, RebaseResult, } from '../../../../src/lib/git/rebase' -import { Commit } from '../../../../src/models/commit' import { AppFileStatusKind, CommittedFileChange, @@ -17,6 +16,7 @@ import { import { createRepository } from '../../../helpers/repository-builder-rebase-test' import { getStatusOrThrow } from '../../../helpers/status' import { getBranchOrError } from '../../../helpers/git' +import { IBranchTip } from '../../../../src/models/branch' const baseBranchName = 'base-branch' const featureBranchName = 'this-is-a-feature' @@ -162,7 +162,7 @@ describe('git/rebase', () => { }) describe('continue after resolving conflicts', () => { - let beforeRebaseTip: Commit + let beforeRebaseTip: IBranchTip let result: RebaseResult let status: IStatusResult @@ -238,7 +238,7 @@ describe('git/rebase', () => { }) describe('continue with additional changes unrelated to conflicted files', () => { - let beforeRebaseTip: Commit + let beforeRebaseTip: IBranchTip let filesInRebasedCommit: ReadonlyArray let result: RebaseResult let status: IStatusResult diff --git a/app/test/unit/group-branches-test.ts b/app/test/unit/group-branches-test.ts index 335f451c3..b4d0a274e 100644 --- a/app/test/unit/group-branches-test.ts +++ b/app/test/unit/group-branches-test.ts @@ -1,28 +1,26 @@ import { groupBranches } from '../../src/ui/branches' import { Branch, BranchType } from '../../src/models/branch' -import { Commit } from '../../src/models/commit' import { CommitIdentity } from '../../src/models/commit-identity' describe('Branches grouping', () => { const author = new CommitIdentity('Hubot', 'hubot@github.com', new Date()) - const commit = new Commit( - '300acef', - '300acef', - 'summary', - 'body', + const branchTip = { + sha: '300acef', author, - author, - [], - [] - ) + } - const currentBranch = new Branch('master', null, commit, BranchType.Local) - const defaultBranch = new Branch('master', null, commit, BranchType.Local) + const currentBranch = new Branch('master', null, branchTip, BranchType.Local) + const defaultBranch = new Branch('master', null, branchTip, BranchType.Local) const recentBranches = [ - new Branch('some-recent-branch', null, commit, BranchType.Local), + new Branch('some-recent-branch', null, branchTip, BranchType.Local), ] - const otherBranch = new Branch('other-branch', null, commit, BranchType.Local) + const otherBranch = new Branch( + 'other-branch', + null, + branchTip, + BranchType.Local + ) const allBranches = [currentBranch, ...recentBranches, otherBranch] diff --git a/app/test/unit/infer-comparison-branch-test.ts b/app/test/unit/infer-comparison-branch-test.ts index 9bad9c0a4..dc62b3753 100644 --- a/app/test/unit/infer-comparison-branch-test.ts +++ b/app/test/unit/infer-comparison-branch-test.ts @@ -1,6 +1,5 @@ import { inferComparisonBranch } from '../../src/lib/stores/helpers/infer-comparison-branch' import { Branch, BranchType } from '../../src/models/branch' -import { Commit } from '../../src/models/commit' import { CommitIdentity } from '../../src/models/commit-identity' import { GitHubRepository } from '../../src/models/github-repository' import { PullRequest, PullRequestRef } from '../../src/models/pull-request' @@ -9,25 +8,20 @@ import { IRemote } from '../../src/models/remote' import { ComparisonCache } from '../../src/lib/comparison-cache' import { gitHubRepoFixture } from '../helpers/github-repo-builder' -function createTestCommit(sha: string) { - return new Commit( - sha, - sha.slice(0, 7), - '', - '', - new CommitIdentity('tester', 'tester@test.com', new Date()), - new CommitIdentity('tester', 'tester@test.com', new Date()), - [], - [] - ) -} - function createTestBranch( name: string, sha: string, remote: string | null = null ) { - return new Branch(name, remote, createTestCommit(sha), BranchType.Local) + return new Branch( + name, + remote, + { + sha, + author: new CommitIdentity('tester', 'tester@test.com', new Date()), + }, + BranchType.Local + ) } function createTestGhRepo( From c8a22db8f2971bc8018d9b4c69659f78229564cc Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 31 Mar 2020 20:28:51 +0200 Subject: [PATCH 8/8] Fix Commit constructor in configureGitUser --- app/src/ui/lib/configure-git-user.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/ui/lib/configure-git-user.tsx b/app/src/ui/lib/configure-git-user.tsx index 4769bb2cd..8231d8645 100644 --- a/app/src/ui/lib/configure-git-user.tsx +++ b/app/src/ui/lib/configure-git-user.tsx @@ -164,7 +164,6 @@ export class ConfigureGitUser extends React.Component< author, author, [], - [], [] ) const emoji = new Map()