##// 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 907 return s
908 908 return s[:i]
909 909
910 def selectfile(afile_orig, bfile_orig, hunk, strip):
911 910 def pathstrip(path, strip):
912 911 pathlen = len(path)
913 912 i = 0
@@ -926,6 +925,7 b' def selectfile(afile_orig, bfile_orig, h'
926 925 count -= 1
927 926 return path[:i].lstrip(), path[i:].rstrip()
928 927
928 def selectfile(afile_orig, bfile_orig, hunk, strip):
929 929 nulla = afile_orig == "/dev/null"
930 930 nullb = bfile_orig == "/dev/null"
931 931 abase, afile = pathstrip(afile_orig, strip)
@@ -1190,6 +1190,9 b' def _applydiff(ui, fp, patcher, copyfn, '
1190 1190 continue
1191 1191 elif state == 'git':
1192 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 1196 if gp.op in ('COPY', 'RENAME'):
1194 1197 copyfn(gp.oldpath, gp.path, cwd)
1195 1198 changed[gp.path] = gp
General Comments 0
You need to be logged in to leave comments. Login now