Skip to content

Commit

Permalink
Add a .gitattributes file to force LF line-endings in .pins files.
Browse files Browse the repository at this point in the history
This change forces the pins files to use LF line-endings and adds a check to
detect CRLF line-endings that outputs a more helpful error message.

BUG=729553

Review-Url: https://codereview.chromium.org/2941543002
Cr-Commit-Position: refs/heads/master@{#485165}
  • Loading branch information
martijnc authored and Commit Bot committed Jul 9, 2017
1 parent c8ddaa9 commit 89d553d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Stop Windows python license check presubmit errors by forcing LF checkout.
*.py text eol=lf

# Force LF checkout of the pins files to avoid transport_security_state_generator errors.
/net/http/*.pins text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ enum class CertificateParserState {
} // namespace

bool ParseCertificatesFile(base::StringPiece certs_input, Pinsets* pinsets) {
if (certs_input.find("\r\n") != base::StringPiece::npos) {
LOG(ERROR) << "CRLF line-endings found in the pins file. All files must "
"use LF (unix style) line-endings.";
return false;
}

std::string line;
CertificateParserState current_state = CertificateParserState::PRE_NAME;

Expand Down

0 comments on commit 89d553d

Please sign in to comment.