File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -359,3 +359,21 @@ void test_diff_parse__lineinfo(void)
359359 git_patch_free (patch );
360360 git_diff_free (diff );
361361}
362+
363+ void test_diff_parse__new_file_with_space (void )
364+ {
365+ const char * content = PATCH_ORIGINAL_NEW_FILE_WITH_SPACE ;
366+ git_patch * patch ;
367+ git_diff * diff ;
368+
369+ cl_git_pass (git_diff_from_buffer (& diff , content , strlen (content )));
370+ cl_git_pass (git_patch_from_diff ((git_patch * * ) & patch , diff , 0 ));
371+
372+ cl_assert_equal_p (patch -> diff_opts .old_prefix , NULL );
373+ cl_assert_equal_p (patch -> delta -> old_file .path , NULL );
374+ cl_assert_equal_s (patch -> diff_opts .new_prefix , "b/" );
375+ cl_assert_equal_s (patch -> delta -> new_file .path , "sp ace.txt" );
376+
377+ git_patch_free (patch );
378+ git_diff_free (diff );
379+ }
Original file line number Diff line number Diff line change 841841 "diff --git a/binary.bin b/binary.bin\n" \
842842 "index 27184d9..7c94f9e 100644\n" \
843843 "Binary files a/binary.bin and b/binary.bin differ\n"
844+
845+ #define PATCH_ORIGINAL_NEW_FILE_WITH_SPACE \
846+ "diff --git a/sp ace.txt b/sp ace.txt\n" \
847+ "new file mode 100644\n" \
848+ "index 000000000..789819226\n" \
849+ "--- /dev/null\n" \
850+ "+++ b/sp ace.txt\n" \
851+ "@@ -0,0 +1 @@\n" \
852+ "+a\n"
You can’t perform that action at this time.
0 commit comments