Skip to content

Commit 3aa381f

Browse files
edgardmessiasJohnstonCode
authored andcommitted
fix: Fixed changelists for externals (close #569) (#597)
1 parent 5d72faf commit 3aa381f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/model.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,28 @@ export class Model implements IDisposable {
378378
}
379379

380380
public async getRepositoryFromUri(uri: Uri): Promise<Repository | null> {
381-
for (const liveRepository of this.openRepositories) {
381+
382+
// Sort by path length (First external and ignored over root)
383+
const open = this.openRepositories.sort(
384+
(a, b) => b.repository.workspaceRoot.length - a.repository.workspaceRoot.length
385+
);
386+
387+
for (const liveRepository of open) {
382388
const repository = liveRepository.repository;
383389

390+
// Ignore path is not child (fix for multiple externals)
391+
if (!isDescendant(repository.workspaceRoot, uri.fsPath)) {
392+
continue;
393+
}
394+
384395
try {
385396
const path = normalizePath(uri.fsPath);
386397

387398
await repository.info(path);
388399

389400
return repository;
390401
} catch (error) {
391-
console.error();
402+
// Ignore
392403
}
393404
}
394405

0 commit comments

Comments
 (0)