From 1faf84f8eb760b003ad2be81432443bf443b82e6 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Mon, 30 May 2016 15:26:23 +0200 Subject: Fix bug in diff parser output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The diff --patch parser was missing some edge case where Git would encode non-ASCII chars in path names as octals, but these weren't decoded properly. \360\237\222\251.txt Decoded via utf-8, that will return: šŸ’©.txt --- git/test/fixtures/diff_patch_unsafe_paths | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'git/test/fixtures') diff --git a/git/test/fixtures/diff_patch_unsafe_paths b/git/test/fixtures/diff_patch_unsafe_paths index 14375f79..9ee6b834 100644 --- a/git/test/fixtures/diff_patch_unsafe_paths +++ b/git/test/fixtures/diff_patch_unsafe_paths @@ -61,6 +61,13 @@ index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94 +++ "b/path/ĀÆ\\_(惄)_|ĀÆ" @@ -0,0 +1 @@ +dummy content +diff --git "a/path/\360\237\222\251.txt" "b/path/\360\237\222\251.txt" +new file mode 100644 +index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 +--- /dev/null ++++ "b/path/\360\237\222\251.txt" +@@ -0,0 +1 @@ ++dummy content diff --git a/a/with spaces b/b/with some spaces similarity index 100% rename from a/with spaces -- cgit v1.2.3 From 0eafe201905d85be767c24106eb1ab12efd3ee22 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Mon, 30 May 2016 16:20:22 +0200 Subject: Add test case as example of Git commit with invalid data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a real commit from the microjs.com open source project, see https://github.com/madrobby/microjs.com/commit/7e8457c17850d0991763941213dcb403d80f39f8, which is declared to be encoded in UTF-8, but contains invalid bytes. This makes GitPython choke on it while decoding. Rather than choking, this should instead accept the error and replace the invalid bytes by the ļæ½ (\x80) char. --- git/test/fixtures/commit_invalid_data | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 git/test/fixtures/commit_invalid_data (limited to 'git/test/fixtures') diff --git a/git/test/fixtures/commit_invalid_data b/git/test/fixtures/commit_invalid_data new file mode 100644 index 00000000..d112bf2d --- /dev/null +++ b/git/test/fixtures/commit_invalid_data @@ -0,0 +1,6 @@ +tree 9f1a495d7d9692d24f5caedaa89f5c2c32d59368 +parent 492ace2ffce0e426ebeb55e364e987bcf024dd3b +author E.Azer KoĆoĆoĆoculu 1306710073 +0300 +committer E.Azer KoĆoĆoĆoculu 1306710073 +0300 + +add environjs -- cgit v1.2.3