##// END OF EJS Templates
patch: strip paths in leaked git patchmeta objects
Mads Kiilerich -
r11022:0429d0d4 default
parent child Browse files
Show More
@@ -907,7 +907,6 b' def parsefilename(str):'
907 return s
907 return s
908 return s[:i]
908 return s[:i]
909
909
910 def selectfile(afile_orig, bfile_orig, hunk, strip):
911 def pathstrip(path, strip):
910 def pathstrip(path, strip):
912 pathlen = len(path)
911 pathlen = len(path)
913 i = 0
912 i = 0
@@ -926,6 +925,7 b' def selectfile(afile_orig, bfile_orig, h'
926 count -= 1
925 count -= 1
927 return path[:i].lstrip(), path[i:].rstrip()
926 return path[:i].lstrip(), path[i:].rstrip()
928
927
928 def selectfile(afile_orig, bfile_orig, hunk, strip):
929 nulla = afile_orig == "/dev/null"
929 nulla = afile_orig == "/dev/null"
930 nullb = bfile_orig == "/dev/null"
930 nullb = bfile_orig == "/dev/null"
931 abase, afile = pathstrip(afile_orig, strip)
931 abase, afile = pathstrip(afile_orig, strip)
@@ -1190,6 +1190,9 b' def _applydiff(ui, fp, patcher, copyfn, '
1190 continue
1190 continue
1191 elif state == 'git':
1191 elif state == 'git':
1192 for gp in values:
1192 for gp in values:
1193 gp.path = pathstrip(gp.path, strip - 1)[1]
1194 if gp.oldpath:
1195 gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
1193 if gp.op in ('COPY', 'RENAME'):
1196 if gp.op in ('COPY', 'RENAME'):
1194 copyfn(gp.oldpath, gp.path, cwd)
1197 copyfn(gp.oldpath, gp.path, cwd)
1195 changed[gp.path] = gp
1198 changed[gp.path] = gp
General Comments 0
You need to be logged in to leave comments. Login now