whatthepatch
whatthepatch copied to clipboard
not discarding "a/" and "b/" prefixes in paths when parsing git patches with no diff
Given a git diff as follows (which only contains header but no diff since it is just renaming):
diff --git a/myfile2.txt b/myfile3.txt
similarity index 100%
rename from myfile2.txt
rename to myfile3.txt
a/ and b/ prefixes are kept in old_path and new_path:
diff(
header=header(index_path=None, old_path='a/myfile2.txt', old_version=None, new_path='b/myfile3.txt', new_version=None),
changes=None,
text='diff --git a/myfile2.txt b/myfile3.txt\nsimilarity index 100%\nrename from myfile2.txt\nrename to myfile3.txt\n'
)