aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-10-19 16:49:56 -0200
committerHisham Muhammad <hisham@gobolinux.org>2015-10-19 16:49:56 -0200
commita65eb6572a24ecfe69f39a8046281fba5007fd50 (patch)
tree28a8a1fd928624c778ca8d2a00610a44c46fafc7
parent8fe1bbd627bae2da2d1b7d8e376a35ebf5626d2e (diff)
parentcfc253ffb580bd30cb004ad3bf4e72b3314791e0 (diff)
downloadluarocks-a65eb6572a24ecfe69f39a8046281fba5007fd50.tar.gz
luarocks-a65eb6572a24ecfe69f39a8046281fba5007fd50.tar.bz2
luarocks-a65eb6572a24ecfe69f39a8046281fba5007fd50.zip
Merge pull request #439 from mpeterv/fix-patch-empty-lines
Fix empty line handling in patch.lua
-rw-r--r--src/luarocks/tools/patch.lua7
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