From 87795fc6350d4ed4cc4eeec004ca93d8cd9ea1e2 Mon Sep 17 00:00:00 2001 From: "rhinoceros.xn" Date: Sat, 1 Jun 2019 19:44:19 +0800 Subject: [PATCH] line.strip('\r\n') contains '\r'. line.strip('\r\n') contains '\r'. --- patch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/patch.py b/patch.py index 4b82af0..6540c10 100755 --- a/patch.py +++ b/patch.py @@ -401,17 +401,20 @@ def lineno(self): # process line first if re.match(b"^[- \\+\\\\]", line): # gather stats about line endings + rc_count = line.strip(b"\r\n").count('\r') if line.endswith(b"\r\n"): p.hunkends["crlf"] += 1 elif line.endswith(b"\n"): p.hunkends["lf"] += 1 elif line.endswith(b"\r"): p.hunkends["cr"] += 1 + p.hunkends["cr"] += rc_count if line.startswith(b"-"): hunkactual["linessrc"] += 1 elif line.startswith(b"+"): hunkactual["linestgt"] += 1 + hunkactual["linestgt"] += rc_count elif not line.startswith(b"\\"): hunkactual["linessrc"] += 1 hunkactual["linestgt"] += 1