##// END OF EJS Templates
Check that git patches only touch files under root
Brendan Cully -
r6758:87c704ac default
parent child Browse files
Show More
@@ -1039,9 +1039,12 b' def applydiff(ui, fp, changed, strip=1, '
1039 continue
1039 continue
1040 elif state == 'git':
1040 elif state == 'git':
1041 gitpatches = values
1041 gitpatches = values
1042 cwd = os.getcwd()
1042 for gp in gitpatches:
1043 for gp in gitpatches:
1043 if gp.op in ('COPY', 'RENAME'):
1044 if gp.op in ('COPY', 'RENAME'):
1044 copyfile(gp.oldpath, gp.path)
1045 src, dst = [util.canonpath(cwd, cwd, x)
1046 for x in [gp.oldpath, gp.path]]
1047 copyfile(src, dst)
1045 changed[gp.path] = (gp.op, gp)
1048 changed[gp.path] = (gp.op, gp)
1046 else:
1049 else:
1047 raise util.Abort(_('unsupported parser state: %s') % state)
1050 raise util.Abort(_('unsupported parser state: %s') % state)
@@ -261,3 +261,15 b' EOF'
261 hg status
261 hg status
262 cat a
262 cat a
263 cd ..
263 cd ..
264
265 echo % 'test paths outside repo root'
266 mkdir outside
267 touch outside/foo
268 hg init inside
269 cd inside
270 hg import - <<EOF
271 diff --git a/a b/b
272 rename from ../outside/foo
273 rename to bar
274 EOF
275 cd ..
@@ -260,3 +260,6 b' a'
260 adding a
260 adding a
261 applying patch from stdin
261 applying patch from stdin
262 bb
262 bb
263 % test paths outside repo root
264 applying patch from stdin
265 abort: ../outside/foo not under root
General Comments 0
You need to be logged in to leave comments. Login now