@@ -793,12 +793,14 @@ def _detect_type(self, p):
793793
794794 def _normalize_filenames (self ):
795795 """ sanitize filenames, normalizing paths, i.e.:
796- 1. strip a/ and b/ prefixes from GIT and HG style patches
797- 2. remove all references to parent directories (with warning)
798- 3. translate any absolute paths to relative (with warning)
796+ 1. remove all references to parent directories (with warning)
797+ 2. translate any absolute paths to relative (with warning)
799798
800799 [x] always use forward slashes to be crossplatform
801800 (diff/patch were born as a unix utility after all)
801+ [x] Do *not* strip a/ and b/ prefixes from GIT and HG style
802+ patches, GNU patch would not do so, instead the user
803+ *must* account for this in the -p/--strip option
802804
803805 return None
804806 """
@@ -809,18 +811,6 @@ def _normalize_filenames(self):
809811 debug (" patch type = %s" % p .type )
810812 debug (" source = %s" % p .source )
811813 debug (" target = %s" % p .target )
812- if p .type in (HG , GIT ):
813- debug ("stripping a/ and b/ prefixes" )
814- if p .source != b'/dev/null' :
815- if not p .source .startswith (b"a/" ):
816- warning ("invalid source filename" )
817- else :
818- p .source = p .source [2 :]
819- if p .target != b'/dev/null' :
820- if not p .target .startswith (b"b/" ):
821- warning ("invalid target filename" )
822- else :
823- p .target = p .target [2 :]
824814
825815 p .source = xnormpath (p .source )
826816 p .target = xnormpath (p .target )
0 commit comments