Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/github-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
11 changes: 11 additions & 0 deletions test/github-package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down