diff --git a/lib/github-package.js b/lib/github-package.js index b8bd2e25b5..cf85dc31d0 100644 --- a/lib/github-package.js +++ b/lib/github-package.js @@ -129,6 +129,10 @@ export default class GithubPackage { } } + if (!activeItem && this.project.getPaths().length === 1) { + nextActiveRepository = await this.getRepositoryForWorkdirPath(this.project.getPaths()[0]); + } + if (nextActiveRepository && nextActiveRepository !== this.activeRepository) { this.setActiveRepository(nextActiveRepository); if (this.destroyedRepositorySubscription) { this.destroyedRepositorySubscription.dispose(); } diff --git a/test/github-package.test.js b/test/github-package.test.js index de81425e26..eacd8655c3 100644 --- a/test/github-package.test.js +++ b/test/github-package.test.js @@ -165,6 +165,17 @@ describe('GithubPackage', function() { assert.isNull(githubPackage.getActiveRepository()); }); + it('defaults to a single repository even without an active pane item', async function() { + const workdirPath = await cloneRepository('three-files'); + project.setPaths([workdirPath]); + await githubPackage.activate(); + + await githubPackage.updateActiveRepository(); + + const repository = await githubPackage.getRepositoryForWorkdirPath(workdirPath); + await assert.async.strictEqual(githubPackage.getActiveRepository(), repository); + }); + // Don't worry about this on Windows as it's not a common op if (process.platform !== 'win32') { it('handles symlinked project paths', async () => {