summaryrefslogtreecommitdiff
path: root/tests/patch/patch_common.h
diff options
context:
space:
mode:
authorDenis Laxalde <denis@laxalde.org>2019-10-16 22:11:33 +0200
committerDenis Laxalde <denis@laxalde.org>2019-10-16 22:53:29 +0200
commit11de594f85479e4804b07dc4f7b33cfe9212bea0 (patch)
tree4212d8619ba52d3c8fc52ef7909a221d8f01d3d5 /tests/patch/patch_common.h
parent9333fc2af65c13c7e6f8450dc7839f481bb018d8 (diff)
downloadlibgit2-11de594f85479e4804b07dc4f7b33cfe9212bea0.tar.gz
patch_parse: handle patches without extended headers
Extended header lines (especially the "index <hash>..<hash> <mode>") are not required by "git apply" so it import patches. So we allow the from-file/to-file lines (--- a/file\n+++ b/file) to directly follow the git diff header. This fixes #5267.
Diffstat (limited to 'tests/patch/patch_common.h')
-rw-r--r--tests/patch/patch_common.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/patch/patch_common.h b/tests/patch/patch_common.h
index 690e0a662..d730d142c 100644
--- a/tests/patch/patch_common.h
+++ b/tests/patch/patch_common.h
@@ -895,3 +895,13 @@
"+++ b/test-file\r\n" \
"@@ -0,0 +1 @@\r\n" \
"+a contents\r\n"
+
+#define PATCH_NO_EXTENDED_HEADERS \
+ "diff --git a/file b/file\n" \
+ "--- a/file\n" \
+ "+++ b/file\n" \
+ "@@ -1,3 +1,3 @@\n" \
+ " a\n" \
+ "-b\n" \
+ "+bb\n" \
+ " c\n"