summaryrefslogtreecommitdiff
path: root/tests/patch/print.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-03-26 14:16:41 +0100
committerPatrick Steinhardt <ps@pks.im>2020-03-26 14:21:35 +0100
commit5f47cb48d388279f92d339a5a791040254ee4d1c (patch)
tree5a2b1f7a3a96f12f19044ef52df88883c99d44d8 /tests/patch/print.c
parentca782c913b7052712c7a6163c102a01733202ebf (diff)
downloadlibgit2-5f47cb48d388279f92d339a5a791040254ee4d1c.tar.gz
patch: correctly handle mode changes for renames
When generating a patch for a renamed file whose mode bits have changed in addition to the rename, then we currently fail to parse the generated patch. Furthermore, when generating a diff we output mode bits after the similarity metric, which is different to how upstream git handles it. Fix both issues by adding another state transition that allows similarity indices after mode changes and by printing mode changes before the similarity index.
Diffstat (limited to 'tests/patch/print.c')
-rw-r--r--tests/patch/print.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/patch/print.c b/tests/patch/print.c
index c4ff479e9..b0a933943 100644
--- a/tests/patch/print.c
+++ b/tests/patch/print.c
@@ -107,6 +107,12 @@ void test_patch_print__rename_exact(void)
strlen(PATCH_RENAME_EXACT));
}
+void test_patch_print__rename_exact_with_mode(void)
+{
+ patch_print_from_patchfile(PATCH_RENAME_EXACT_WITH_MODE,
+ strlen(PATCH_RENAME_EXACT_WITH_MODE));
+}
+
void test_patch_print__rename_similar(void)
{
patch_print_from_patchfile(PATCH_RENAME_SIMILAR,