Skip to content

Enable auto EOL on git repo side, fix some character encoding issues - #4912

Merged
Dongbo Wang (daxian-dbw) merged 7 commits into
PowerShell:masterfrom
SteveL-MSFT:file-cleanup
Sep 25, 2017
Merged

Dongbo Wang (daxian-dbw) merged 7 commits into
PowerShell:masterfrom
SteveL-MSFT:file-cleanup

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Some of the cleanup work from #4761

  • add ending newline to files missing it
  • update .gitattributes to enforce autocrlf on all text files (this means some of the files show broader changes because it had CRLF on the repo side, but should just be LF)
  • added missing opening element
  • fix mis-encoded character to apostrophe
  • fix copyright symbol where it didn't show up correctly in vscode (although it shows up fine here, it's using the unicode symbol instead of the extended ascii one)

cc Michael Klement (@mklement0) Mark Kraus (@markekraus)

@markekraus

Copy link
Copy Markdown
Contributor

Just to state the obvious, but, the hashes in the tests will need to be updated for the files which were modified.

updated file hashes in the test
@SteveL-MSFT
Steve Lee (SteveL-MSFT) force-pushed the file-cleanup branch 3 times, most recently from 0fc3fd6 to 08c4e00 Compare September 25, 2017 03:07
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Sep 25, 2017 •

Copy link
Copy Markdown
Member Author

Not sure why the FileCatalog test is failing on AppVeyor. Passing on my WS2016 and WS2012R2 boxes.

Figured it out, resaving it locally with just LF EOL I get the same hash as on AppVeyor. So I'm resaving the test file as LF so it should be consistent everywhere.

updated testfile hash due to change on EOL
changed tests that were always skipping to pending
resaved TestFileCatalog.txt with LF EOL to be consistent with behavior on AppVeyor
GUID = '41486F7D-842F-40F1-ACE4-8405F9C2ED9B'
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="(c) Microsoft Corporation. All rights reserved."

@iSazonov Ilya (iSazonov) Sep 25, 2017 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why we use defferent "c"? I see:

  • Copyright (c)
  • Copyright (C)
  • Copyright ©

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I vaguely recall (c) is completely wrong, (C) has no legal weight, and that © should be used unless the intended process or system cannot parse it (in which case fall back to (C). But I can't find a source.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

IANAL, but doing a search tells me the Berne Convention says none of those symbols are actually needed. Let me follow up with our legal team to see what they recommend so we have consistency. Based on prior experience, I don't expect them to get back to me very quickly, so I suggest we have this as a separate issue #4917

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can look CoreFX experience.

Comment thread .gitattributes
@@ -1 +1,3 @@
CHANGELOG.md merge=union
* text=auto

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Based on my reading of the docs, this will only work if the files are not committed CRLF.

When text is set to "auto", the path is marked for automatic end-of-line conversion. If Git decides that the content is text, its line endings are converted to LF on checkin. When the file has been committed with CRLF, no conversion is done.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

From https://www.git-scm.com/docs/gitattributes:

If you want to ensure that text files that any contributor introduces to the repository have their line endings normalized, you can set the text attribute to "auto" for all files.

*	text=auto

The actual conversion of files that have CRLF (or worse mixed EOL) will be part of #4910 which we'll do after 6.0.0 final since it touches so many files.

@TravisEz13

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) Do you want to wait for the copyright issue to be resolved before merging?

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Travis Plunk (@TravisEz13) no, I created a separate issue for it #4917

@daxian-dbw

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) quick question, I noticed that some © has been changed to (c) and some are not (e.g. https://github.com/PowerShell/PowerShell/pull/4912/files?w=1#diff-fd6789ade5008bce347f09499cd96bf5R3). Is that intentional?

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) I only changed the ones that were using the Unicode version that doesn't show up in VSCode (easy to search for). I left the ones that use extended ascii. So intentional.

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 901a61b into PowerShell:master Sep 25, 2017
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the file-cleanup branch October 26, 2018 21:33
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
…owerShell#4912)

- add ending newline to files missing it using:
`awk -F: '$2 ~ / no line terminators/ {print $1}' ~/text-files.txt | xargs -I{} sh -c 'printf "\n" >> "$1"' - {}`
- update .gitattributes to enforce autocrlf on all text files
- added <copyright> opening element where it was missing
removed file attribute pointing to wrong filename
- fix mis-encoded character to apostrophe
- replace incorrect encoding of copyright symbol with (c)
- updated file hashes in the test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants