From 494bbe391baf5309fee40537c7c408ad8c77915c Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 21:04:34 -0800 Subject: [PATCH 01/14] Initial UI for initialization --- lib/controllers/git-tab-controller.js | 1 + lib/controllers/root-controller.js | 6 ++++++ lib/views/git-tab-view.js | 14 +++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/controllers/git-tab-controller.js b/lib/controllers/git-tab-controller.js index 1cdde65f9a..922ca2ec2a 100644 --- a/lib/controllers/git-tab-controller.js +++ b/lib/controllers/git-tab-controller.js @@ -37,6 +37,7 @@ export default class GitTabController { workspace={this.props.workspace} commandRegistry={this.props.commandRegistry} notificationManager={this.props.notificationManager} + initializeRepo={this.props.initializeRepo} didSelectFilePath={this.props.didSelectFilePath} didDiveIntoFilePath={this.props.didDiveIntoFilePath} didSelectMergeConflictFile={this.props.didSelectMergeConflictFile} diff --git a/lib/controllers/root-controller.js b/lib/controllers/root-controller.js index f18fe6e471..5b187d0369 100644 --- a/lib/controllers/root-controller.js +++ b/lib/controllers/root-controller.js @@ -151,6 +151,7 @@ export default class RootController extends React.Component { commandRegistry={this.props.commandRegistry} notificationManager={this.props.notificationManager} repository={this.props.repository} + initializeRepo={this.initializeRepo} resolutionProgress={this.props.resolutionProgress} isAmending={this.state.amending} didSelectFilePath={this.showFilePatchForPath} @@ -238,6 +239,11 @@ export default class RootController extends React.Component { } } + @autobind + initializeRepo() { + console.log('hi'); + } + @autobind async showFilePatchForPath(filePath, stagingStatus, {activate, amending} = {}) { if (!filePath) { return null; } diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index 3005cf9e6c..b165c7c8e5 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -35,7 +35,13 @@ export default class GitTabView { if (!this.props.repository) { return (
-
No repository for active pane item
+
+
ICON
+
Initialize this project with a Git repository
+ +
); } else if (this.props.fetchInProgress) { @@ -99,6 +105,12 @@ export default class GitTabView { return etch.destroy(this); } + @autobind + initializeRepo(event) { + event.preventDefault(); + this.props.initializeRepo(); + } + @autobind blur() { this.props.workspace.getActivePane().activate(); From c5df91238928ec9b01399b66e384d010c955e216 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:00:06 -0800 Subject: [PATCH 02/14] Track active project path --- lib/github-package.js | 14 ++++++++++++-- test/github-package.test.js | 14 +++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/github-package.js b/lib/github-package.js index 005d9656c5..f50d9cafde 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -168,6 +168,10 @@ export default class GithubPackage { return this.initModelsPromise; } + getActiveProjectPath() { + return this.activeProjectPath; + } + getActiveRepository() { return this.activeRepository; } @@ -178,12 +182,13 @@ export default class GithubPackage { async updateActiveModels() { await this.initModelsPromise; - let nextActiveRepository, nextActiveResolutionProgress; + let nextActiveRepository, nextActiveResolutionProgress, nextActiveProjectPath; const activeItem = this.workspace.getActivePaneItem(); if (activeItem && typeof activeItem.getPath === 'function') { const projectPath = this.projectPathForItemPath(activeItem.getPath()); if (projectPath) { + nextActiveProjectPath = projectPath; await Promise.all([ this.getRepositoryForWorkdirPath(projectPath).then(r => { nextActiveRepository = r; }), this.getResolutionProgressForWorkdirPath(projectPath).then(rp => { nextActiveResolutionProgress = rp; }), @@ -192,17 +197,20 @@ export default class GithubPackage { } else { nextActiveRepository = this.activeRepository; nextActiveResolutionProgress = this.activeResolutionProgress; + nextActiveProjectPath = this.activeProjectPath; } if (activeItem instanceof FilePatchController) { if (!activeItem.props.repository.isDestroyed()) { nextActiveRepository = activeItem.props.repository; nextActiveResolutionProgress = activeItem.props.resolutionProgress; + nextActiveProjectPath = nextActiveRepository.getWorkingDirectoryPath(); } } if (!activeItem && this.project.getPaths().length === 1) { - nextActiveRepository = await this.getRepositoryForWorkdirPath(this.project.getPaths()[0]); + nextActiveProjectPath = this.project.getPaths()[0]; + nextActiveRepository = await this.getRepositoryForWorkdirPath(nextActiveProjectPath); } if (nextActiveRepository && nextActiveRepository !== this.activeRepository) { @@ -220,6 +228,8 @@ export default class GithubPackage { if (!nextActiveRepository) { this.setActiveModels(null, null); } + + this.activeProjectPath = nextActiveProjectPath || null; } setActiveModels(repository, resolutionProgress) { diff --git a/test/github-package.test.js b/test/github-package.test.js index ff20f4c19f..030b7934e2 100644 --- a/test/github-package.test.js +++ b/test/github-package.test.js @@ -47,7 +47,7 @@ describe('GithubPackage', function() { }); describe('changing the project paths', function() { - it('updates the active repository', async function() { + it('updates the active repository and project path', async function() { const workdirPath1 = await cloneRepository('three-files'); const workdirPath2 = await cloneRepository('three-files'); const nonRepositoryPath = temp.mkdirSync(); @@ -60,20 +60,24 @@ describe('GithubPackage', function() { await workspace.open(path.join(workdirPath1, 'a.txt')); const repository1 = await githubPackage.getRepositoryForWorkdirPath(workdirPath1); await assert.async.strictEqual(githubPackage.getActiveRepository(), repository1); + await assert.async.equal(githubPackage.getActiveProjectPath(), workdirPath1); await assert.async.equal(githubPackage.rerender.callCount, 1); // Remove repository for open file project.setPaths([workdirPath2, nonRepositoryPath]); + await assert.async.equal(githubPackage.getActiveProjectPath(), workdirPath1); await assert.async.isNull(githubPackage.getActiveRepository()); await assert.async.equal(githubPackage.rerender.callCount, 2); await workspace.open(path.join(workdirPath2, 'b.txt')); const repository2 = await githubPackage.getRepositoryForWorkdirPath(workdirPath2); await assert.async.strictEqual(githubPackage.getActiveRepository(), repository2); + await assert.async.equal(githubPackage.getActiveProjectPath(), workdirPath2); await assert.async.equal(githubPackage.rerender.callCount, 3); await workspace.open(path.join(nonRepositoryPath, 'c.txt')); await assert.async.isNull(githubPackage.getActiveRepository()); + await assert.async.equal(githubPackage.getActiveProjectPath(), nonRepositoryPath); await assert.async.equal(githubPackage.rerender.callCount, 4); }); @@ -140,34 +144,42 @@ describe('GithubPackage', function() { await githubPackage.updateActiveModels(); assert.isNotNull(githubPackage.getActiveRepository()); + assert.equal(githubPackage.getActiveProjectPath(), workdirPath2); assert.equal(githubPackage.getActiveRepository(), await githubPackage.getRepositoryForWorkdirPath(workdirPath2)); await workspace.open(path.join(nonRepositoryPath, 'c.txt')); await githubPackage.updateActiveModels(); + assert.equal(githubPackage.getActiveProjectPath(), nonRepositoryPath); assert.isNull(githubPackage.getActiveRepository()); await workspace.open(path.join(workdirPath1, 'a.txt')); await githubPackage.updateActiveModels(); + assert.equal(githubPackage.getActiveProjectPath(), workdirPath1); assert.equal(githubPackage.getActiveRepository(), await githubPackage.getRepositoryForWorkdirPath(workdirPath1)); workspace.getActivePane().activateItem({}); // such as when find & replace results pane is focused await githubPackage.updateActiveModels(); + assert.equal(githubPackage.getActiveProjectPath(), workdirPath1); assert.equal(githubPackage.getActiveRepository(), await githubPackage.getRepositoryForWorkdirPath(workdirPath1)); await workspace.open(path.join(workdirPath2, 'b.txt')); await githubPackage.updateActiveModels(); + assert.equal(githubPackage.getActiveProjectPath(), workdirPath2); assert.equal(githubPackage.getActiveRepository(), await githubPackage.getRepositoryForWorkdirPath(workdirPath2)); project.removePath(workdirPath2); await githubPackage.updateActiveModels(); + assert.isNull(githubPackage.getActiveProjectPath()); assert.isNull(githubPackage.getActiveRepository()); project.removePath(workdirPath1); await githubPackage.updateActiveModels(); + assert.isNull(githubPackage.getActiveProjectPath()); assert.isNull(githubPackage.getActiveRepository()); await workspace.open(path.join(workdirPath1, 'a.txt')); await githubPackage.updateActiveModels(); + assert.isNull(githubPackage.getActiveProjectPath()); assert.isNull(githubPackage.getActiveRepository()); }); From 8f921b07e906e7d35f5ce30bff1782ee8f980b6f Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:00:29 -0800 Subject: [PATCH 03/14] Ensure temp paths match by using realpathSync on them --- test/github-package.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/github-package.test.js b/test/github-package.test.js index 030b7934e2..fb3450cb43 100644 --- a/test/github-package.test.js +++ b/test/github-package.test.js @@ -50,7 +50,7 @@ describe('GithubPackage', function() { it('updates the active repository and project path', async function() { const workdirPath1 = await cloneRepository('three-files'); const workdirPath2 = await cloneRepository('three-files'); - const nonRepositoryPath = temp.mkdirSync(); + const nonRepositoryPath = fs.realpathSync(temp.mkdirSync()); fs.writeFileSync(path.join(nonRepositoryPath, 'c.txt')); project.setPaths([workdirPath1, workdirPath2, nonRepositoryPath]); fs.writeFileSync(path.join(workdirPath1, 'a.txt'), 'change 1', 'utf8'); @@ -134,7 +134,7 @@ describe('GithubPackage', function() { it('updates the active repository based on the active item, setting it to null when the active item is not in a project repository', async function() { const workdirPath1 = await cloneRepository('three-files'); const workdirPath2 = await cloneRepository('three-files'); - const nonRepositoryPath = temp.mkdirSync(); + const nonRepositoryPath = fs.realpathSync(temp.mkdirSync()); fs.writeFileSync(path.join(nonRepositoryPath, 'c.txt')); project.setPaths([workdirPath1, workdirPath2, nonRepositoryPath]); await githubPackage.activate(); @@ -198,7 +198,7 @@ describe('GithubPackage', function() { // Repository with a merge conflict, repository without a merge conflict, path without a repository const workdirMergeConflict = await cloneRepository('merge-conflict'); const workdirNoConflict = await cloneRepository('three-files'); - const nonRepositoryPath = temp.mkdirSync(); + const nonRepositoryPath = fs.realpathSync(temp.mkdirSync()); fs.writeFileSync(path.join(nonRepositoryPath, 'c.txt')); project.setPaths([workdirMergeConflict, workdirNoConflict, nonRepositoryPath]); @@ -242,7 +242,7 @@ describe('GithubPackage', function() { if (process.platform !== 'win32') { it('handles symlinked project paths', async () => { const workdirPath = await cloneRepository('three-files'); - const symlinkPath = temp.mkdirSync() + '-symlink'; + const symlinkPath = fs.realpathSync(temp.mkdirSync()) + '-symlink'; fs.symlinkSync(workdirPath, symlinkPath); project.setPaths([symlinkPath]); await githubPackage.activate(); From 0989e0aaee1d73c24708f28c6c4a170084e2876c Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:18:03 -0800 Subject: [PATCH 04/14] Don't reject uncaught when setting up ResolutionProgress in new repo --- lib/github-package.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github-package.js b/lib/github-package.js index f50d9cafde..8b2031cc9e 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -296,7 +296,8 @@ export default class GithubPackage { const savedResolutionProgress = this.savedState.resolutionProgressByPath[projectPath] || {}; const resolutionProgressPromise = repository.getLastCommit() - .then(commit => new ResolutionProgress(commit.sha, savedResolutionProgress)); + .then(commit => new ResolutionProgress(commit.sha, savedResolutionProgress)) + .catch(() => null); // Technically this should wait on repositoryPromise too, but we know for a fact that it's already // resolved. From 1dc74702333b0322333df916c24199fa0305c31d Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:29:29 -0800 Subject: [PATCH 05/14] Slight tweak to active project path tracking --- lib/github-package.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/github-package.js b/lib/github-package.js index 8b2031cc9e..84ae74987a 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -214,6 +214,7 @@ export default class GithubPackage { } if (nextActiveRepository && nextActiveRepository !== this.activeRepository) { + this.activeProjectPath = nextActiveProjectPath || null; this.setActiveModels(nextActiveRepository, nextActiveResolutionProgress); if (this.destroyedRepositorySubscription) { this.destroyedRepositorySubscription.dispose(); } @@ -223,13 +224,14 @@ export default class GithubPackage { } this.destroyedRepositorySubscription.dispose(); }); + } else { + this.activeProjectPath = nextActiveProjectPath || null; + this.rerender(); } if (!nextActiveRepository) { this.setActiveModels(null, null); } - - this.activeProjectPath = nextActiveProjectPath || null; } setActiveModels(repository, resolutionProgress) { From e4788c46d79cb46445ae4d13a3ceae40542ba68e Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:30:01 -0800 Subject: [PATCH 06/14] Add Repository.init() --- lib/git-shell-out-strategy.js | 4 ++++ lib/models/repository.js | 10 ++++++++++ test/models/repository.test.js | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/lib/git-shell-out-strategy.js b/lib/git-shell-out-strategy.js index 7387b22c0d..335c96c550 100644 --- a/lib/git-shell-out-strategy.js +++ b/lib/git-shell-out-strategy.js @@ -152,6 +152,10 @@ export default class GitShellOutStrategy { } } + init() { + return this.exec(['init', this.workingDir]); + } + /** * Staging/Unstaging files and patches and committing */ diff --git a/lib/models/repository.js b/lib/models/repository.js index 3a3294b47d..ee84a3a51c 100644 --- a/lib/models/repository.js +++ b/lib/models/repository.js @@ -43,6 +43,12 @@ export default class Repository { } } + static async init(workingDirectoryPath, gitStrategy) { + const strategy = gitStrategy || CompositeGitStrategy.create(workingDirectoryPath); + await strategy.init(workingDirectoryPath); + return this.open(workingDirectoryPath, strategy); + } + static githubInfoFromRemote(remote) { // proto login domain owner repo const regex = /(?:.+:\/\/)?(?:.+@)?github\.com[:/]([^/]+)\/(.+)/; @@ -122,6 +128,10 @@ export default class Repository { /* eslint-enable no-console */ } + isGitRepository() { + return this.git.isGitRepository(); + } + fetchStatusesForChangedFiles() { return this.git.getStatusesForChangedFiles(); } diff --git a/test/models/repository.test.js b/test/models/repository.test.js index fb8dd50093..c10988f27a 100644 --- a/test/models/repository.test.js +++ b/test/models/repository.test.js @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; import dedent from 'dedent-js'; +import temp from 'temp'; import Repository from '../../lib/models/repository'; @@ -39,6 +40,15 @@ describe('Repository', function() { }); }); + describe('init', function() { + it('creates a repository in the given dir and returns the repository', async function() { + const soonToBeRepositoryPath = fs.realpathSync(temp.mkdirSync()); + const repo = await Repository.init(soonToBeRepositoryPath); + assert.isTrue(await repo.isGitRepository()); + assert.equal(repo.getWorkingDirectoryPath(), soonToBeRepositoryPath); + }); + }); + describe('staging and unstaging files', function() { it('can stage and unstage modified files', async function() { const workingDirPath = await cloneRepository('three-files'); From 7946fec0e6cf88a6e6642173808161f118450d20 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:30:22 -0800 Subject: [PATCH 07/14] Click a button, :boom: new repo --- lib/controllers/root-controller.js | 7 ++++++- lib/github-package.js | 18 ++++++++++++++++++ test/github-package.test.js | 17 +++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/controllers/root-controller.js b/lib/controllers/root-controller.js index 5b187d0369..8c87ee8736 100644 --- a/lib/controllers/root-controller.js +++ b/lib/controllers/root-controller.js @@ -38,6 +38,8 @@ export default class RootController extends React.Component { notificationManager: React.PropTypes.object.isRequired, tooltips: React.PropTypes.object.isRequired, confirm: React.PropTypes.func.isRequired, + activeProjectPath: React.PropTypes.string, + createRepositoryForProjectPath: React.PropTypes.func, repository: React.PropTypes.object, resolutionProgress: React.PropTypes.object, statusBar: React.PropTypes.object, @@ -48,6 +50,9 @@ export default class RootController extends React.Component { static defaultProps = { savedState: {}, githubEnabled: false, + createRepositoryForProjectPath: () => { + throw new Error('default createRepositoryForProjectPath not implemented'); + }, } serialize() { @@ -241,7 +246,7 @@ export default class RootController extends React.Component { @autobind initializeRepo() { - console.log('hi'); + this.props.createRepositoryForProjectPath(this.props.activeProjectPath); } @autobind diff --git a/lib/github-package.js b/lib/github-package.js index 84ae74987a..18da053f2b 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -122,11 +122,13 @@ export default class GithubPackage { notificationManager={this.notificationManager} tooltips={this.tooltips} confirm={this.confirm} + activeProjectPath={this.activeProjectPath} repository={this.getActiveRepository()} resolutionProgress={this.getActiveResolutionProgress()} statusBar={this.statusBar} savedState={this.savedState.gitController} githubEnabled={this.config.get('github.githubEnabled')} + createRepositoryForProjectPath={this.createRepositoryForProjectPath} />, this.element, ); } @@ -155,6 +157,22 @@ export default class GithubPackage { await this.destroyModelsForPaths(Array.from(removed)); } + @autobind + async createRepositoryForProjectPath(projectPath) { + if (!projectPath) { + throw new Error('Must specify a project path to create a repository for'); + } + await Repository.init(projectPath); + this.modelsByProjectPath.delete(projectPath); + this.modelPromisesByProjectPath.delete(projectPath); + const promises = this.cacheModelsForPaths([projectPath]); + await Promise.all([ + promises.changeObserversStartedPromise, + promises.modelsPromise, + ]); + await this.updateActiveModels(); + } + @autobind didChangeActivePaneItem() { this.updateActiveModels(); diff --git a/test/github-package.test.js b/test/github-package.test.js index fb3450cb43..2fa5dac660 100644 --- a/test/github-package.test.js +++ b/test/github-package.test.js @@ -308,6 +308,23 @@ describe('GithubPackage', function() { }); }); + describe('#createRepositoryForProjectPath', function() { + it('creates and sets a repository for the given project path', async function() { + const workdirPath1 = await cloneRepository('three-files'); + const workdirPath2 = await cloneRepository('three-files'); + const nonRepositoryPath = fs.realpathSync(temp.mkdirSync()); + fs.writeFileSync(path.join(nonRepositoryPath, 'c.txt')); + project.setPaths([workdirPath1, workdirPath2, nonRepositoryPath]); + await githubPackage.activate(); + + await workspace.open(path.join(nonRepositoryPath, 'c.txt')); + await assert.async.isNull(githubPackage.getActiveRepository()); + await githubPackage.createRepositoryForProjectPath(nonRepositoryPath); + assert.isOk(githubPackage.getActiveRepository()); + assert.equal(githubPackage.getActiveRepository(), await githubPackage.getRepositoryForWorkdirPath(nonRepositoryPath)); + }); + }); + describe('#projectPathForItemPath', function() { it('does not error when the path is falsy (e.g. new unsaved file)', function() { sinon.stub(project, 'getDirectories').returns([new Directory('path')]); From a186fb7c240d0d82c7fa7183df9d516c51da96f1 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:36:47 -0800 Subject: [PATCH 08/14] Show different UI while creating repo --- lib/views/git-tab-view.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index b165c7c8e5..50b83bd476 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -13,6 +13,7 @@ export default class GitTabView { constructor(props) { this.props = props; etch.initialize(this); + this.repoCreationInProgress = false; this.element.addEventListener('focusin', this.rememberLastFocus); @@ -38,8 +39,8 @@ export default class GitTabView {
ICON
Initialize this project with a Git repository
-
@@ -106,9 +107,16 @@ export default class GitTabView { } @autobind - initializeRepo(event) { + async initializeRepo(event) { event.preventDefault(); - this.props.initializeRepo(); + this.repoCreationInProgress = true; + etch.update(this); + try { + await this.props.initializeRepo(); + } finally { + this.repoCreationInProgress = false; + etch.update(this); + } } @autobind From cda70332439208a3747a0b43c53857f223d5b1e6 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:53:26 -0800 Subject: [PATCH 09/14] Add Git logo svg --- lib/views/git-logo.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/views/git-logo.js diff --git a/lib/views/git-logo.js b/lib/views/git-logo.js new file mode 100644 index 0000000000..3af325c6f3 --- /dev/null +++ b/lib/views/git-logo.js @@ -0,0 +1,24 @@ +/** @jsx etch.dom */ +import etch from 'etch'; + +export default class GitLogo { + constructor() { + etch.initialize(this); + } + + update() {} + + render() { + /* eslint-disable */ + return ( + + + + + + + + ) + /* eslint-enable */ + } +} From d99b57ec89e8473e99c778eef190183a67ec4c82 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 22:53:37 -0800 Subject: [PATCH 10/14] Some minor styling --- lib/views/git-tab-view.js | 9 ++++++--- styles/git-panel.less | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index 50b83bd476..607786c9ca 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -7,6 +7,7 @@ import etch from 'etch'; import {autobind} from 'core-decorators'; import StagingView from './staging-view'; +import GitLogo from './git-logo'; import CommitViewController from '../controllers/commit-view-controller'; export default class GitTabView { @@ -37,9 +38,11 @@ export default class GitTabView { return (
-
ICON
-
Initialize this project with a Git repository
-
diff --git a/styles/git-panel.less b/styles/git-panel.less index fc41ecd5ea..9607d6c72d 100644 --- a/styles/git-panel.less +++ b/styles/git-panel.less @@ -17,11 +17,27 @@ -webkit-user-select: none; cursor: default; - &.is-loading, - &.no-repository { + &.is-loading, &.no-repository { padding: @component-padding * 3; text-align: center; - color: @text-color-subtle; + } + + &.is-loading { font-style: italic; + color: @text-color-subtle; + } + + &.no-repository { + display: flex; + justify-content: center; + font-size: 16px; + + > * { + margin: 10px 0; + } + + .git-logo-path { + fill: @text-color-subtle; + } } } From 7e1dfe6caf3b13ef14e25632722a1d3088b9dc5d Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 27 Feb 2017 23:00:35 -0800 Subject: [PATCH 11/14] Don't call rerender too many times --- lib/github-package.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/github-package.js b/lib/github-package.js index 18da053f2b..6899258c5d 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -242,12 +242,11 @@ export default class GithubPackage { } this.destroyedRepositorySubscription.dispose(); }); - } else { + } else if (nextActiveRepository && this.activeProjectPath !== nextActiveProjectPath) { this.activeProjectPath = nextActiveProjectPath || null; this.rerender(); - } - - if (!nextActiveRepository) { + } else if (!nextActiveRepository) { + this.activeProjectPath = nextActiveProjectPath || null; this.setActiveModels(null, null); } } From 9206272e3d52b0a7d88a761be4256de9495f6788 Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 28 Feb 2017 19:52:26 +0900 Subject: [PATCH 12/14] :art: --- styles/git-panel.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/styles/git-panel.less b/styles/git-panel.less index 9607d6c72d..6c069df539 100644 --- a/styles/git-panel.less +++ b/styles/git-panel.less @@ -30,14 +30,14 @@ &.no-repository { display: flex; justify-content: center; - font-size: 16px; + font-size: 1.25em; > * { - margin: 10px 0; + margin: @component-padding 0; } .git-logo-path { - fill: @text-color-subtle; + fill: mix(@base-background-color, @text-color, 66%); // 2/3 of bg color } } } From d6431f2cc710fdd949efd3eeea3f76244259e808 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Tue, 28 Feb 2017 10:49:27 -0800 Subject: [PATCH 13/14] :fire: non-useful default prop --- lib/controllers/root-controller.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/controllers/root-controller.js b/lib/controllers/root-controller.js index 8c87ee8736..88910f8307 100644 --- a/lib/controllers/root-controller.js +++ b/lib/controllers/root-controller.js @@ -50,9 +50,6 @@ export default class RootController extends React.Component { static defaultProps = { savedState: {}, githubEnabled: false, - createRepositoryForProjectPath: () => { - throw new Error('default createRepositoryForProjectPath not implemented'); - }, } serialize() { From 003120230ed8fd8f82763d2d11877ec44475476a Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Tue, 28 Feb 2017 10:50:04 -0800 Subject: [PATCH 14/14] :fire: unneeded catch --- lib/github-package.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/github-package.js b/lib/github-package.js index 6899258c5d..2b7906b913 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -315,8 +315,7 @@ export default class GithubPackage { const savedResolutionProgress = this.savedState.resolutionProgressByPath[projectPath] || {}; const resolutionProgressPromise = repository.getLastCommit() - .then(commit => new ResolutionProgress(commit.sha, savedResolutionProgress)) - .catch(() => null); + .then(commit => new ResolutionProgress(commit.sha, savedResolutionProgress)); // Technically this should wait on repositoryPromise too, but we know for a fact that it's already // resolved.