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

Restore broken AutoCRLF tests #8041

Merged
3 commits merged into from Apr 27, 2020
Merged

Restore broken AutoCRLF tests #8041

3 commits merged into from Apr 27, 2020

Conversation

RussKie
Copy link
Member

@RussKie RussKie commented Apr 26, 2020

Resolves #8000

Proposed changes

  • Restore broken AutoCRLF tests

    The tests got broken for few reasons:

    1. Earlier versions of ApprovalTests considered differences in EOL, and these tests deal with precisely this.
      However recently we have updated to the newer version of ApprovalTests that no longer considered EOL differences as failures.

    2. During migration to Arcade SDK (Use Microsoft Arcade to improve build pipelines #7649) few approved files had their EOL accidentally converted to CRLF, that was unnoticed due to the reasons explained above.

    CRLF conversion is moved out of FileViewer because it has no real connection to it. The tests refactored and verified for correctness.

  • Move FileViewer members to give some logical order

  • Remove unused FileViewer members

Best review commit-by-commit.

❗ Do not squash!

Groupped members by type: properties, public, protected, private, event handlers.
No other changes of any kind
@ghost ghost assigned RussKie Apr 26, 2020
@RussKie RussKie requested review from mstv and gerhardol and removed request for mstv April 26, 2020 09:38
@RussKie
Copy link
Member Author

RussKie commented Apr 26, 2020

OT: @gerhardol I noticed a peculiar behaviour that is quite confusing. I think you worked in this area not that long ago.

Before committing files I have two different representations of files:

  • added binary file (staged/unstaged):
    image

  • renamed/moved/deleted binary file:
    image

When files are committed and I look at the diff all "binary" files are shown similar to this:
image

I can see how this can be confusing to users. Is this something we track somewhere, or I should raise an new issue for?

@codecov
Copy link

codecov bot commented Apr 26, 2020

Codecov Report

Merging #8041 into master will decrease coverage by 0.02%.
The diff coverage is 49.71%.

@@            Coverage Diff             @@
##           master    #8041      +/-   ##
==========================================
- Coverage   49.60%   49.58%   -0.03%     
==========================================
  Files         844      846       +2     
  Lines       60849    60884      +35     
  Branches    10877    10899      +22     
==========================================
+ Hits        30185    30189       +4     
- Misses      28448    28480      +32     
+ Partials     2216     2215       -1     
Flag Coverage Δ
#production 37.42% <48.68%> (-0.02%) ⬇️
#tests 94.88% <100.00%> (+0.04%) ⬆️

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

For those intimidated by the number of lines in this PR: See last commit and FileViewer.cs and review from there

I can see how this can be confusing to users. Is this something we track somewhere, or I should raise an new issue for?

Git do not show diff for files set to binary, why I suggest other attributes for these files. (That can be done in other ways too, but keeping lines down as we are not likely to merge these anyway).
For files where the line ending indicates that the file is a binary file, GE shows binary "diffs" the same as new.
GE may check Git attributes too for new files (not in all situations though...) why the binary status is detected for the new file.

I would propose to not change this behavior for diffs, it is an extra Git command that with viruses like Symantec could add 100 ms.
Sure we could add an issue, but I do not think that will help anyone.

.gitattributes Outdated Show resolved Hide resolved
GitUI/Editor/FileViewer.cs Show resolved Hide resolved
@RussKie
Copy link
Member Author

RussKie commented Apr 27, 2020

I would propose to not change this behavior for diffs, it is an extra Git command that with viruses like Symantec could add 100 ms.
Sure we could add an issue, but I do not think that will help anyone.

Certainly not changing here. Just an observation at this stage.

Resolves #8000

The tests got broken for few reasons:

1. Earlier versions of ApprovalTests considered differences in EOL, and
these tests deal with precisely this.
However recently we have updated to the newer version of ApprovalTests
that no longer considered EOL differences as failures.

2. During migration to Arcade SDK (#7649) few approved files had their
EOL accidentally converted to CRLF, that was unnoticed due to the reasons
explained above.

CRLF conversion is moved out of `FileViewer` because it has no real
connection to it.
The tests refactored and verified for correctness.
@ghost
Copy link

ghost commented Apr 27, 2020

Hello @RussKie!

Because this pull request has the status: auto merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 79899e7 into master Apr 27, 2020
@ghost ghost deleted the fix_8000 branch April 27, 2020 12:03
@ghost ghost added this to the 4.0 milestone Apr 27, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review FileViewerTextTests.DoAutoCRLF tests
2 participants