Skip to content

Commit

Permalink
Sorting repositories when searching by Uri to ensure nested repositor…
Browse files Browse the repository at this point in the history
…ies are found if appropriate.
  • Loading branch information
Peter Kahle committed Oct 13, 2017
1 parent 9e2338a commit 4723490
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion extensions/git/src/model.ts
Expand Up @@ -299,7 +299,7 @@ export class Model {
if (hint instanceof Uri) {
const resourcePath = hint.fsPath;

for (const liveRepository of this.openRepositories) {
for (const liveRepository of this.openRepositories.sort((a, b) => b.repository.root.length - a.repository.root.length)) {
const relativePath = path.relative(liveRepository.repository.root, resourcePath);

if (!/^\.\./.test(relativePath)) {
Expand Down

1 comment on commit 4723490

@petkahl
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poor commit message, should have been:

Sort repositories when searching by URI

When ignoring a file, it was added to the top level .gitignore, rather than the one for the submodule.
Since this is only an issue for nested git repositories, it might be better to do the sort after adding submodule repositories in scanForSubmodules, or just always keep it in order.

Please sign in to comment.