Skip to content

Commit 00ca55e

Browse files
committed
---
yaml --- r: 535 b: refs/heads/master c: b4f9277 h: refs/heads/master i: 533: 041397f 531: 1d790ed 527: eb4c090 v: v3
1 parent 241f6cc commit 00ca55e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 724d7235e546fb79009800700fd74328f8171b8c
2+
refs/heads/master: b4f92774d0b6b60b747f97344c18c5f51de18469

trunk/src/etc/tidy.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!/usr/bin/python
22

3-
import sys, fileinput
3+
import sys, fileinput, subprocess
44

55
err=0
66
cols=78
77

8+
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
9+
stdout=subprocess.PIPE)
10+
result=config_proc.communicate()[0]
11+
autocrlf=result.strip() == b"true" if result is not None else False
12+
813
def report_err(s):
914
global err
1015
print("%s:%d: %s" % (fileinput.filename(), fileinput.filelineno(), s))
@@ -14,10 +19,11 @@ def report_err(s):
1419
if line.find('\t') != -1 and fileinput.filename().find("Makefile") == -1:
1520
report_err("tab character")
1621

17-
if line.find('\r') != -1:
22+
if not autocrlf and line.find('\r') != -1:
1823
report_err("CR character")
1924

20-
if len(line)-1 > cols:
25+
line_len = len(line)-2 if autocrlf else len(line)-1
26+
if line_len > cols:
2127
report_err("line longer than %d chars" % cols)
2228

2329

0 commit comments

Comments
 (0)