diff options
| -rw-r--r-- | src/luarocks/tools/patch.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua index b53bad61..9e5074ad 100644 --- a/src/luarocks/tools/patch.lua +++ b/src/luarocks/tools/patch.lua | |||
| @@ -200,8 +200,13 @@ function patch.read_patch(filename, data) | |||
| 200 | if state == 'hunkbody' then | 200 | if state == 'hunkbody' then |
| 201 | -- skip hunkskip and hunkbody code until definition of hunkhead read | 201 | -- skip hunkskip and hunkbody code until definition of hunkhead read |
| 202 | 202 | ||
| 203 | if line:match"^[\r\n]*$" then | ||
| 204 | -- prepend space to empty lines to interpret them as context properly | ||
| 205 | line = " " .. line | ||
| 206 | end | ||
| 207 | |||
| 203 | -- process line first | 208 | -- process line first |
| 204 | if line:match"^[- +\\]" or line:match"^[\r\n]*$" then | 209 | if line:match"^[- +\\]" then |
| 205 | -- gather stats about line endings | 210 | -- gather stats about line endings |
| 206 | local he = files.hunkends[nextfileno] | 211 | local he = files.hunkends[nextfileno] |
| 207 | if endswith(line, "\r\n") then | 212 | if endswith(line, "\r\n") then |
