Skip to content

Commit d366d8a

Browse files
committed
Ensure 'patched' is always printed when it should be in PATCH.LUA
1 parent fe38cb2 commit d366d8a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xtra/PATCH.LUA

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ local function patch(p)
1515
o,e=io.open(f,"w")if not o then return abort()end
1616
b,e=io.open(f..".orig")if not b then return abort()end
1717
if of then of:close()end if bf then bf:close()end of,ol,bf,bl,h=o,0,b,0,nil return true end
18-
local function writeRemainder()if of then local rest=bf:read("*l")while rest do of:write(rest..'\n')rest=bf:read("*l")end of:close()of,ol=nil,0 end bf:close()bf,bl,h=nil,0,nil end
18+
local function writeRemainder()if h then if h.o.l~=bl-(h.o.s-1)or h.n.l~=ol-(h.n.s-1)then print(M)os.exit(1)else print("patched")end end
19+
if of then local rest=bf:read("*l")while rest do of:write(rest..'\n')rest=bf:read("*l")end of:close()of,ol=nil,0 end bf:close()bf,bl,h=nil,0,nil end
1920
local n=pf:read("*l")while n do
2021
local l,ls=n n=pf:read("*l")ls=l:sub(1,1)
2122
if ls=='+'then
@@ -41,7 +42,7 @@ local function patch(p)
4142
for _=1,s do
4243
local ctx=bf:read("*l")if not ctx then print(M)os.exit(1)end
4344
bl=bl+1 if of then of:write(ctx.."\n")ol=ol+1 end end end end end end
44-
pf:close()if h then print("patched")end if bf then writeRemainder()end end
45+
pf:close()if bf then writeRemainder()end end
4546
if #arg<1 then print(arg[-1].." "..arg[0]..[[ diff...
4647
4748
Patch a unified difference file]])os.exit(1)end patch(arg[1])

0 commit comments

Comments
 (0)