summaryrefslogtreecommitdiff
path: root/tests/patch/patch_common.h
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/patch_common.h
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/patch_common.h')
-rw-r--r--tests/patch/patch_common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/patch/patch_common.h b/tests/patch/patch_common.h
index 731524767..1e03889fc 100644
--- a/tests/patch/patch_common.h
+++ b/tests/patch/patch_common.h
@@ -579,6 +579,14 @@
"rename from file.txt\n" \
"rename to newfile.txt\n"
+#define PATCH_RENAME_EXACT_WITH_MODE \
+ "diff --git a/RENAMED.md b/README.md\n" \
+ "old mode 100644\n" \
+ "new mode 100755\n" \
+ "similarity index 100%\n" \
+ "rename from RENAMED.md\n" \
+ "rename to README.md\n"
+
#define PATCH_RENAME_SIMILAR \
"diff --git a/file.txt b/newfile.txt\n" \
"similarity index 77%\n" \