diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-03-26 14:16:41 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-03-26 14:21:35 +0100 |
commit | 5f47cb48d388279f92d339a5a791040254ee4d1c (patch) | |
tree | 5a2b1f7a3a96f12f19044ef52df88883c99d44d8 /tests/patch/print.c | |
parent | ca782c913b7052712c7a6163c102a01733202ebf (diff) | |
download | libgit2-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.c | 6 |
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, |