Skip to content

Fix git diff detection code #13851

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

Merged
merged 1 commit into from
Sep 9, 2020
Merged

Fix git diff detection code #13851

merged 1 commit into from
Sep 9, 2020

Conversation

joyceerhl
Copy link

@joyceerhl joyceerhl commented Sep 9, 2020

For https://github.com/microsoft/vscode-python/issues/13569

I regressed this as part of the filesystem refactor. In the following snippet, editor.document.uri has scheme file, but the git diff editor has scheme git, so doing a full URI object comparison via arePathsSame always returned false. I believe this is an exceptional case where we should be using fsPath instead of the URI object when comparing URIs.

        const gitSchemeEditor = this.documentManager.visibleTextEditors.find(
            (editorUri) =>
                editorUri.document &&
                editorUri.document.uri.scheme === 'git' &&
                this.fs.arePathsSame(editorUri.document.uri, editor.document.uri)
        );
  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

@joyceerhl joyceerhl added the no-changelog No news entry required label Sep 9, 2020
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 9, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2020

Codecov Report

Merging #13851 into main will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13851      +/-   ##
==========================================
- Coverage   59.98%   59.95%   -0.03%     
==========================================
  Files         685      685              
  Lines       38006    38006              
  Branches     5474     5474              
==========================================
- Hits        22797    22788       -9     
- Misses      14034    14040       +6     
- Partials     1175     1178       +3     
Impacted Files Coverage Δ
src/client/datascience/crossProcessLock.ts 79.41% <0.00%> (-11.77%) ⬇️
src/client/common/utils/platform.ts 56.00% <0.00%> (-8.00%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
src/client/datascience/debugLocationTracker.ts 76.56% <0.00%> (-1.57%) ⬇️
src/client/common/process/proc.ts 14.49% <0.00%> (-0.73%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6741162...4a5769f. Read the comment docs.

@joyceerhl joyceerhl merged commit 44d9c80 into microsoft:main Sep 9, 2020
@@ -378,7 +378,7 @@ export class NativeEditorProviderOld extends NativeEditorProvider {
(editorUri) =>
editorUri.document &&
editorUri.document.uri.scheme === 'git' &&
this.fs.arePathsSame(editorUri.document.uri, editor.document.uri)
editorUri.document.uri.fsPath === editor.document.uri.fsPath

Choose a reason for hiding this comment

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

Suggested change
editorUri.document.uri.fsPath === editor.document.uri.fsPath
editorUri.document.uri.fsPath === editor.document.uri.fsPath

Adding a comment would be useful & probably adding a test to ensure this works with different resource schemes (I'm assuming that's the case here).

Choose a reason for hiding this comment

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

I.e. we need to ensure we do not regress again, comment + test would be useful.

Copy link
Author

Choose a reason for hiding this comment

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

Oh, sorry, merged this before this comment showed up! I'll put up a new PR @DonJayamanne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants