Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extraneous entries in Source Control view for nested Git repos #7629

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

westbury
Copy link
Contributor

@westbury westbury commented Apr 20, 2020

This PR brings @theia/git behavior into line with the vs-code Git built-in. If a Git repository has a nested Git repository then @theia/git returns a single change resource for that repository. This results in an entry in the Source Control view that does not really make sense. Such entries do not appear when using the Git built-in, and of course would not appear in vs-code.

What it does

This PR filters out change resources that represent nested Git repositories. These are the only change resources returned by 'git status' that are folder URIs, so can be easily identified by a trailing '/'.

How to test

Create a Git repository with one or more nested Git repositories. On master branch, Open the Source Control view with @theia/git and with vs-code builtin. Note the extraneous entries only with @theia/git. Now test with this PR and the extraneous entries should be gone.

Review checklist

Reminder for reviewers

@westbury westbury added the git issues related to git label Apr 20, 2020
@kittaakos kittaakos removed their request for review September 11, 2020 13:06
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

@westbury is the pull-request still valid, if so can you please rebase and I can take a look for you 👍

…itories

Signed-off-by: Nigel Westbury <nigelipse@miegel.org>
@westbury
Copy link
Contributor Author

westbury commented Feb 24, 2021

@vince-fugnitto Thanks for looking at this. Yes, it is still an issue that we would like to get fixed. I have rebased it.

You will see that the extraneous entries all end with '/', and are the only entries that end with '/'. I was wondering if there was a better way of detecting these entries so I looked to see what vscode does. It seems they do exactly the same:
https://github.com/microsoft/vscode/blob/90cc8b14687b0465c6fb8bf169ae42b70429ac49/extensions/git/src/git.ts#L661

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

@westbury we might benefit from adding a unit-test under dugite.spec.ts for nested repos 👍

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirmed the bug on master and how this pull-request resolves similarly to vscode 👍
My only comment was adding a unit-test for it but I'll leave that up to your discretion.

@vince-fugnitto vince-fugnitto merged commit 5bb23f4 into eclipse-theia:master Feb 25, 2021
@westbury westbury deleted the nested-repos branch February 25, 2021 16:16
@paul-marechal paul-marechal added this to the 1.11.0 milestone Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git issues related to git
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants